mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Fixed crash when ScriptComponent has no Instance in Play Mode
This commit is contained in:
@@ -106,6 +106,8 @@ namespace GlitchyEngine.World
|
||||
for (let (handle, script) in target._ecsWorld.Enumerate<ScriptComponent>())
|
||||
{
|
||||
Entity entity = .(handle, this);
|
||||
|
||||
if (script.Instance != null)
|
||||
ScriptEngine.CopyEditorFieldsToInstance(entity, script);
|
||||
}
|
||||
|
||||
@@ -284,6 +286,9 @@ namespace GlitchyEngine.World
|
||||
if (!script.IsInitialized)
|
||||
ScriptEngine.InitializeInstance(Entity(entity, this), script);
|
||||
|
||||
if (script.Instance == null)
|
||||
continue;
|
||||
|
||||
if (mode.HasFlag(.Runtime))
|
||||
script.Instance.InvokeOnCreate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user