Skip to content

Commit

Permalink
add CreateEntities() example
Browse files Browse the repository at this point in the history
  • Loading branch information
friflo committed Aug 2, 2024
1 parent c5ceaf1 commit 164d474
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Tests/ECS/Examples/Optimization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ public static void CreateEntityOperation()
Console.WriteLine(taggedEntities); // > Query: [#MyTag1] Count: 10
}

[Test]
public static void CreateEntities()
{
var store = new EntityStore();
var archetype = store.GetArchetype(ComponentTypes.Get<Position, Scale3>(), Tags.Get<MyTag1>());
archetype.CreateEntities(100_000); // ~ 0.5 ms
Console.WriteLine(store.Count); // 100000
}

/// Obsolete! Prefer using significant more performant <c>CreateEntity()</c> overloads used
/// in <see cref="CreateEntityOperation"/> above.
[Test]
Expand Down

0 comments on commit 164d474

Please sign in to comment.