MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / RegisterObject

Method RegisterObject

Source/Engine/Scripting/Scripting.cpp:1090–1115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1088}
1089
1090void Scripting::RegisterObject(ScriptingObject* obj)
1091{
1092 PROFILE_MEM(Scripting);
1093 const Guid id = obj->GetID();
1094 ScopeLock lock(_objectsLocker);
1095
1096 //ASSERT(!_objectsDictionary.ContainsValue(obj));
1097#if ENABLE_ASSERTION
1098#if USE_OBJECTS_DISPOSE_CRASHES_DEBUGGING
1099 ScriptingObjectData other;
1100 if (_objectsDictionary.TryGet(id, other))
1101#else
1102 ScriptingObject* other;
1103 if (_objectsDictionary.TryGet(id, other))
1104#endif
1105 {
1106 // Something went wrong...
1107 LOG(Error, "Objects registry already contains object with ID={0} (type '{3}')! Trying to register object {1} (type '{2}').", id, obj->ToString(), String(obj->GetClass()->GetFullName()), String(other->GetClass()->GetFullName()));
1108 }
1109#endif
1110
1111#if USE_OBJECTS_DISPOSE_CRASHES_DEBUGGING
1112 LOG(Info, "[RegisterObject] obj = 0x{0:x}, {1}", (uint64)obj, String(ScriptingObjectData(obj).TypeName));
1113#endif
1114 _objectsDictionary[id] = obj;
1115}
1116
1117void Scripting::UnregisterObject(ScriptingObject* obj)
1118{

Callers 13

InvokeObjectSpawnFunction · 0.45
AddObjectMethod · 0.45
CreateVirtualAssetMethod · 0.45
LoadAsyncMethod · 0.45
FromBytesMethod · 0.45
OnBeginMethod · 0.45
OnSpawnMethod · 0.45
OnSyncPrefabsMethod · 0.45
ApplyAllInternalMethod · 0.45

Calls 6

ScriptingObjectDataClass · 0.85
GetIDMethod · 0.80
StringFunction · 0.50
TryGetMethod · 0.45
ToStringMethod · 0.45
GetClassMethod · 0.45

Tested by

no test coverage detected