diff --git a/src/ECS/Entity/EntityState.cs b/src/ECS/Entity/EntityState.cs index c7e3a9b0..92ae5541 100644 --- a/src/ECS/Entity/EntityState.cs +++ b/src/ECS/Entity/EntityState.cs @@ -4,7 +4,7 @@ // ReSharper disable once CheckNamespace namespace Friflo.Engine.ECS; -public readonly struct EntityState +public readonly ref struct EntityState { #region entity getter public bool IsNull => archetype == null; diff --git a/src/Tests/ECS/Entity/Test_EntityState.cs b/src/Tests/ECS/Entity/Test_EntityState.cs index 942c79ad..f9d407f2 100644 --- a/src/Tests/ECS/Entity/Test_EntityState.cs +++ b/src/Tests/ECS/Entity/Test_EntityState.cs @@ -31,12 +31,22 @@ public static void Test_EntityState_getter() state = entity.State; IsTrue(state.IsNull); Throws(() => { - _ = state.Tags; + GetTags(entity); }); Throws(() => { - _ = state.Get(); + GetComponent(entity); }); } + + private static void GetTags(Entity entity) { + var state = entity.State; + _ = state.Tags; + } + + private static void GetComponent(Entity entity) { + var state = entity.State; + _ = state.Get(); + } } }