Small script engine improvements

- Fixed script class name not visible in Component Editor
- Retain user assembly file system watcher (fixed deletion while handling events)
- Fixed crash when a scritp constains a List or Array (by ignoring them for now)
- Fixed Typo in Genericinst
- Scene: Invoke OnCreate for copied entity scripts
This commit is contained in:
Simon Lübeß
2023-10-28 21:48:43 +02:00
parent 909012f518
commit 38fc1f63b3
5 changed files with 53 additions and 28 deletions
+11
View File
@@ -841,6 +841,9 @@ namespace GlitchyEngine.World
// TODO: Copy Data from one instance to another
//ScriptEngine.CopyFieldsToInstance(targetScript, sourceScript);
// TODO: Only if we are in Runtime
targetScript.Instance.InvokeOnCreate();
}
// This is kinda slow because it's in O(n*m) where n is the tree depth and m is the total number of entities in the scene...
@@ -920,6 +923,14 @@ namespace GlitchyEngine.World
}
}
private void OnComponentRemoved(Entity entity, Type componentType, void* component)
{
if (_onComponentAddedHandlers.TryGetValue(componentType, let handler))
{
handler(entity, componentType, component);
}
}
public WorldEnumerator<TComponent> GetEntities<TComponent>() where TComponent : struct
{
return _ecsWorld.Enumerate<TComponent>();