Near V1.0

This commit is contained in:
2026-02-08 12:57:20 -05:00
parent 6032a04ad9
commit e987c8092f
11 changed files with 82 additions and 48 deletions

View File

@@ -8,19 +8,16 @@ public sealed partial class Body
{
public Generic AddComponent<Generic>(object[] args) where Generic : Component {
if (SingletonExists<Generic>()) { Debug.LogError("Cannot add component when singleton exists!"); return null; }
if (SingletonExists<Generic>())
throw new Exception("Cannot add component when singleton exists!");
Generic component = (Generic) Activator.CreateInstance(typeof(Generic), args);
if(component == null)
throw new Exception("Failed to create component!");
components.Add(component);
if (component == null) { Debug.LogError("Failed to create component!"); return null; }
_components.Add(component);
component.Initiate(this);
ComponentCreatedEvent?.Invoke(this, new ComponentCreateEvent(component, this, scene));
ComponentCreatedEvent?.Invoke(this, new ComponentCreateEvent(component, this, Scene));
return component;
}

View File

@@ -5,6 +5,6 @@ namespace Awperative;
public sealed partial class Scene
{
//todo: add scene.destroy in v5
}
}