Add entities SerializationTest

This commit is contained in:
2025-12-21 13:07:59 +09:00
parent 00b4e82ded
commit 840cf7dd5a
13 changed files with 257 additions and 29 deletions

View File

@@ -161,16 +161,17 @@ public unsafe partial class EntityManager : IDisposable
/// <summary>
/// Create multiple entities with specified components.
/// </summary>
/// <param name="allocator">The allocator to use for the returned array.</param>
/// <param name="entities">The span to store the created entities.</param>
/// <param name="set">A set of component type IDs to add to the entities.</param>
/// <returns>An array of the created entities.</returns>
public void CreateEntities(Span<Entity> entities, ComponentSet set)
{
var arcID = _world.GetArchetypeIDBySignatureHash(set.GetHashCode());
var hash = set.GetHashCode();
var arcID = _world.GetArchetypeIDBySignatureHash(hash);
if (arcID.IsInvalid)
{
arcID = _world.CreateArchetype(set.Components, set.GetHashCode());
arcID = _world.CreateArchetype(set.Components, hash);
}
ref var archetype = ref _world.GetArchetypeReference(arcID);