Documentation

Unity Engine

Download Unity

Unity Engine

GetSharedComponentIndex

Gets the index of a shared component value of an entity, and the world the index belongs to.
Read time 1 minuteLast updated a day ago

Definition

  • Type: Method
  • Namespace: Unity.Entities
  • Assembly: UnityEngine.EntitiesModule

GetSharedComponentIndex<T>(Entity, WorldUnmanaged)

Gets the index of a shared component value of an entity, and the world the index belongs to.
public static int GetSharedComponentIndex<T>(Entity entity, out WorldUnmanaged world) where T : unmanaged, ISharedComponentData

Parameters

entity

The entity.

The world that owns the entity, and so the index.

Returns

Type

Description

intThe shared component index in
world
.

Remarks

Shared component indices are per world, so the index is only meaningful in
world
.

GetSharedComponentIndex<T>(WorldUnmanaged, Entity)

Gets the index of a shared component value of an entity in the given world.
public static int GetSharedComponentIndex<T>(WorldUnmanaged world, Entity entity) where T : unmanaged, ISharedComponentData

Parameters

The world that owns the entity. An entity from another world is treated as missing.

entity

The entity.

Returns

Type

Description

intThe shared component index in
world
.