Fix crash after scripting hot-reload in editor due to cached class attribute objects

#1108
This commit is contained in:
Wojtek Figat
2023-05-19 13:53:49 +02:00
parent 7b8c013918
commit 144b72109b
5 changed files with 33 additions and 0 deletions

View File

@@ -299,6 +299,17 @@ void MCore::UnloadEngine()
ShutdownHostfxr();
}
#if USE_EDITOR
void MCore::OnMidHotReload()
{
// Clear any cached class attributes (see https://github.com/FlaxEngine/FlaxEngine/issues/1108)
for (auto e : CachedClassHandles)
e.Value->_attributes.Clear();
}
#endif
MObject* MCore::Object::Box(void* value, const MClass* klass)
{
static void* BoxValuePtr = GetStaticMethodPointer(TEXT("BoxValue"));