Class · Ara
World
Random access to ECS data from behaviours and commands (which run with exclusive world access). Systems never use this: they declare their components as parameters so the scheduler can run them in parallel. References stay valid until the current callback returns; structural changes go through Commands.
public static class WorldMethods
Query
public static Span<Entity> Query<T>(Span<Entity> scratch) where T : IComponent<T>;Copies entities carrying T into caller-owned scratch storage, in ascending handle order. Throws if the span is too small; no silently truncated gameplay queries.
Get
public static ref T Get<T>(Entity entity) where T : IComponent<T>;The entity's component, for reading and writing. Throws if it is missing.
Set
public static void Set<T>(Entity entity, in T value) where T : IComponent<T>;Replaces an existing component; structural insertion uses Commands.Add.
Read
public static ref readonly T Read<T>(Entity entity) where T : IComponent<T>;The entity's component, read-only. Throws if it is missing.
Has
public static bool Has<T>(Entity entity) where T : IComponent<T>;True if the entity exists and has the component.
Resource
public static ref T Resource<T>() where T : unmanaged, IResource<T>;A world resource, for reading and writing. Throws if it is not registered.