refactor: implement auto-tracking for component modifications
Introduce nested batching scopes to automate component dirty-marking and defer structural mutations. - Replace manual `MarkModified` with auto-tracking via `RefN` properties in `Select` iterators and `GetComponent`/`GetSingleton` calls. - Implement nested batching scopes: `SystemGroup` (tick level), `ISystem.Run` (system level), `CommandQueue.ExecuteAll` (command level), and `Select` (iteration level). - Update `ISystem` and `ITickedSystem` to use `RunImpl` to separate implementation from the batching-aware `Run` extension method. - Add `ValN` properties to iterators for read-only, non-tracked access. - Update documentation to reflect the new iteration and batching model.
This commit is contained in:
@@ -46,7 +46,7 @@ public static class WorldQueryExtensions
|
||||
return new Select6<T1, T2, T3, T4, T5, T6>(world, query);
|
||||
}
|
||||
|
||||
// ── FindEntity / FindEntities ────────────────────────────────────
|
||||
// ── FindEntity ──────────────────────────────────────────────────
|
||||
|
||||
public static Entity FindEntity<T1>(this World world, Query<T1> query = default)
|
||||
where T1 : struct
|
||||
@@ -68,33 +68,6 @@ public static class WorldQueryExtensions
|
||||
using var iter = new Select3<T1, T2, T3>(world, query);
|
||||
return iter.MoveNext() ? iter.Entity : Entity.Null;
|
||||
}
|
||||
|
||||
public static List<Entity> FindEntities<T1>(this World world, Query<T1> query = default)
|
||||
where T1 : struct
|
||||
{
|
||||
var list = new List<Entity>();
|
||||
using var iter = new Select1<T1>(world, query);
|
||||
while (iter.MoveNext()) list.Add(iter.Entity);
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<Entity> FindEntities<T1, T2>(this World world, Query<T1, T2> query = default)
|
||||
where T1 : struct where T2 : struct
|
||||
{
|
||||
var list = new List<Entity>();
|
||||
using var iter = new Select2<T1, T2>(world, query);
|
||||
while (iter.MoveNext()) list.Add(iter.Entity);
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<Entity> FindEntities<T1, T2, T3>(this World world, Query<T1, T2, T3> query = default)
|
||||
where T1 : struct where T2 : struct where T3 : struct
|
||||
{
|
||||
var list = new List<Entity>();
|
||||
using var iter = new Select3<T1, T2, T3>(world, query);
|
||||
while (iter.MoveNext()) list.Add(iter.Entity);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Ref struct enumerators ───────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user