These are the docs for 12.2, an old version of SpatialOS. The docs for this version are frozen: we do not correct, update or republish them. 14.5 is the newest →

Getting information about local entities

The SpatialOS utility class exposes the following methods for retrieving entities checked out by a worker:

  • public static Worker.Entity GetLocalEntity(EntityId entityId);

    Returns the entity object, if it is available on this worker, or null otherwise.

    For example, SpatialOS.GetLocalEntity(entityId).

  • public static IComponentData<T> GetLocalEntityComponent<T>(EntityId entityId) where T : IComponentMetaclass

    Returns a component of the specified type, or null if either the entity or the component is not available on this worker.

    For example, to get the value of the exampleProperty property on the ExampleComponent component, you’d use SpatialOS.GetLocalEntityComponent<ExampleComponent>(entityId).Get().Value.exampleProperty.

For getting information about entities that are located anywhere in the simulated world, use queries.

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums