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

Method ChangeID

Source/Engine/Scripting/ScriptingObject.cpp:277–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275}
276
277void ScriptingObject::ChangeID(const Guid& newId)
278{
279 ASSERT(newId.IsValid() && newId != _id);
280
281 const Guid prevId = _id;
282 _id = newId;
283
284 // Update managed instance
285 const auto managedInstance = GetManagedInstance();
286 const auto klass = GetClass();
287 if (managedInstance && klass)
288 {
289 const MField* monoIdField = klass->GetField(ScriptingObject_id);
290 if (monoIdField)
291 monoIdField->SetValue(managedInstance, &_id);
292 }
293
294 // Update scripting
295 if (IsRegistered())
296 Scripting::OnObjectIdChanged(this, prevId);
297 _type.GetType().Module->OnObjectIdChanged(this, prevId);
298}
299
300void ScriptingObject::SetManagedInstance(MObject* instance)
301{

Callers 1

ObjectInternal_ChangeIDFunction · 0.45

Calls 8

OnObjectIdChangedFunction · 0.85
GetManagedInstanceFunction · 0.70
GetClassFunction · 0.50
IsValidMethod · 0.45
GetFieldMethod · 0.45
SetValueMethod · 0.45
OnObjectIdChangedMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected