forked from Misaki/GhostEngine
ECS refactor: new ComponentSet, serialization, generators
Major ECS API overhaul: added ComponentSet, refactored ComponentRegistry, and updated all entity/component creation methods. Introduced robust custom serialization infrastructure and per-component source generators for registration and (de)serialization. Updated editor, engine, and test code to use new APIs. Improved code quality, naming, and performance throughout. Removed obsolete code and updated dependencies.
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
using Ghost.SparseEntities;
|
||||
using Ghost.SparseEntities.Components;
|
||||
using Ghost.SparseEntities.Query;
|
||||
using Ghost.Entities;
|
||||
|
||||
namespace Ghost.Editor.Core.Inspector;
|
||||
|
||||
public unsafe readonly struct ComponentObject
|
||||
public readonly struct ComponentObject
|
||||
{
|
||||
private readonly World _world;
|
||||
private readonly Entity _entity;
|
||||
@@ -15,15 +13,15 @@ public unsafe readonly struct ComponentObject
|
||||
_entity = entity;
|
||||
}
|
||||
|
||||
public CompRef<T> GetData<T>()
|
||||
where T : unmanaged, IComponentData
|
||||
public ref T GetData<T>()
|
||||
where T : unmanaged, IComponent
|
||||
{
|
||||
return _world.EntityManager.GetComponent<T>(_entity);
|
||||
return ref _world.EntityManager.GetComponent<T>(_entity);
|
||||
}
|
||||
|
||||
public void SetData<T>(in T data)
|
||||
where T : unmanaged, IComponentData
|
||||
where T : unmanaged, IComponent
|
||||
{
|
||||
_world.EntityManager.SetComponent(_entity, in data);
|
||||
_world.EntityManager.SetComponent(_entity, data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user