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

Method DeleteInstance

Source/Engine/Content/JsonAsset.cpp:526–555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

524}
525
526void JsonAsset::DeleteInstance()
527{
528 ScopeLock lock(Locker);
529
530 // C# instance
531 MObject* object = GetManagedInstance();
532 MClass* klass = GetClass();
533 if (object && klass)
534 {
535 const MField* field = klass->GetField("_instance");
536 if (field)
537 field->SetValue(object, nullptr);
538 }
539
540 // C++ instance
541 if (!Instance)
542 return;
543 if (_dtor)
544 {
545 _dtor(Instance);
546 _dtor = nullptr;
547 Allocator::Free(Instance);
548 }
549 else
550 {
551 Delete((ScriptingObject*)Instance);
552 }
553 InstanceType = ScriptingTypeHandle();
554 Instance = nullptr;
555}
556
557#if USE_EDITOR
558

Callers

nothing calls this directly

Calls 7

DeleteFunction · 0.85
GetManagedInstanceFunction · 0.70
GetClassFunction · 0.50
FreeFunction · 0.50
ScriptingTypeHandleClass · 0.50
GetFieldMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected