add IEcsStructPool<T>.NewEntity()

This commit is contained in:
DCFApixels 2025-03-15 22:27:57 +08:00
parent 04a2d44596
commit 1cc630edba

View File

@ -249,6 +249,18 @@ namespace DCFApixels.DragonECS
{
return self == null || self == EcsNullPool.instance;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ref T NewEntity<T>(this IEcsStructPool<T> self) where T : struct
{
var e = self.World.NewEntity();
return ref self.Add(e);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ref T NewEntity<T>(this IEcsStructPool<T> self, out int entityID) where T : struct
{
entityID = self.World.NewEntity();
return ref self.Add(entityID);
}
}
#endregion