---
title: GetSharedComponentIndex
product: Unity Editor
version: '7000.0'
latest_version: '7000.0'
status: This page documents version 7000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/entities/globalentitymanager/getsharedcomponentindex
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/entities/globalentitymanager/getsharedcomponentindex.md
last_updated: 2026-11-03
generated_at: 2026-11-04T08:28:33.312Z
locale: en-us
---

# GetSharedComponentIndex

> Gets the index of a shared component value of an entity, and the world the index belongs to.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **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.

```csharp
public static int GetSharedComponentIndex<T>(Entity entity, out WorldUnmanaged world) where T : unmanaged, ISharedComponentData
```

### Parameters

**** (\[Entity]\(/engine/7000.0/script-reference/unity/entities/entity)): The entity.**** (\[WorldUnmanaged]\(/engine/7000.0/script-reference/unity/entities/worldunmanaged)): The world that owns the entity, and so the index.

### Returns

| Type                                                       | Description                            |
| ---------------------------------------------------------- | -------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The 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.

```csharp
public static int GetSharedComponentIndex<T>(WorldUnmanaged world, Entity entity) where T : unmanaged, ISharedComponentData
```

### Parameters

**** (\[WorldUnmanaged]\(/engine/7000.0/script-reference/unity/entities/worldunmanaged)): The world that owns the entity. An entity from another world is treated as missing.**** (\[Entity]\(/engine/7000.0/script-reference/unity/entities/entity)): The entity.

### Returns

| Type                                                       | Description                            |
| ---------------------------------------------------------- | -------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The shared component index in `world`. |
