Method GetComponentObject
GetComponentObject<T>(Entity)
Gets the managed UnityEngine.Component object from an entity.
Declaration
[Obsolete("Managed-component access (AddComponentObject/GetComponentObject/SetComponentObject) is deprecated and will be removed. Convert your data to an unmanaged IComponentData and use the unmanaged Add/Get/SetComponentData APIs. To reference UnityEngine.Object instances, use UnityObjectRef<T>. First deprecated in 6.6.")]
[ExcludeFromBurstCompatTesting("Returns managed object")]
public T GetComponentObject<T>(Entity entity)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | entity | The entity. |
Returns
| Type | Description |
|---|---|
| T | The managed object, cast to type T. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the managed object. |
Remarks
Accessing data in a managed object forfeits many opportunities for increased performance. Using managed objects should be avoided or used sparingly.
The method also works for adding managed objects implementing IComponentData, but GetComponentData is the preferred method for those objects.
GetComponentObject<T>(Entity, ComponentType)
Gets the managed UnityEngine.Component object from an entity.
Declaration
[Obsolete("Managed-component access (AddComponentObject/GetComponentObject/SetComponentObject) is deprecated and will be removed. Convert your data to an unmanaged IComponentData and use the unmanaged Add/Get/SetComponentData APIs. To reference UnityEngine.Object instances, use UnityObjectRef<T>. First deprecated in 6.6.")]
[ExcludeFromBurstCompatTesting("Returns managed object")]
public T GetComponentObject<T>(Entity entity, ComponentType componentType)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | entity | The entity. |
| ComponentType | componentType | The type of the managed object. |
Returns
| Type | Description |
|---|---|
| T | The managed object, cast to type T. |
Type Parameters
| Name | Description |
|---|---|
| T | The return type of the managed object. |
Remarks
Accessing data in a managed object forfeits many opportunities for increased performance. Using managed objects should be avoided or used sparingly.
The method also works for adding managed objects implementing IComponentData, but GetComponentData is the preferred method for those objects.
GetComponentObject<T>(SystemHandle)
Gets the managed UnityEngine.Component object from an entity associated with a system.
Declaration
[Obsolete("Managed-component access (AddComponentObject/GetComponentObject/SetComponentObject) is deprecated and will be removed. Convert your data to an unmanaged IComponentData and use the unmanaged Add/Get/SetComponentData APIs. To reference UnityEngine.Object instances, use UnityObjectRef<T>. First deprecated in 6.6.")]
[ExcludeFromBurstCompatTesting("Returns managed object")]
public T GetComponentObject<T>(SystemHandle system)
Parameters
| Type | Name | Description |
|---|---|---|
| SystemHandle | system | The system handle. |
Returns
| Type | Description |
|---|---|
| T | The managed object, cast to type T. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the managed object. |
Remarks
Accessing data in a managed object forfeits many opportunities for increased performance. Using managed objects should be avoided or used sparingly.
The method also works for adding managed objects implementing IComponentData, but GetComponentData is the preferred method for those objects.
GetComponentObject<T>(SystemHandle, ComponentType)
Gets the managed UnityEngine.Component object from an entity associated with a system.
Declaration
[Obsolete("Managed-component access (AddComponentObject/GetComponentObject/SetComponentObject) is deprecated and will be removed. Convert your data to an unmanaged IComponentData and use the unmanaged Add/Get/SetComponentData APIs. To reference UnityEngine.Object instances, use UnityObjectRef<T>. First deprecated in 6.6.")]
[ExcludeFromBurstCompatTesting("Returns managed object")]
public T GetComponentObject<T>(SystemHandle system, ComponentType componentType)
Parameters
| Type | Name | Description |
|---|---|---|
| SystemHandle | system | The system handle. |
| ComponentType | componentType | The type of the managed object. |
Returns
| Type | Description |
|---|---|
| T | The managed object, cast to type T. |
Type Parameters
| Name | Description |
|---|---|
| T | The return type of the managed object. |
Remarks
Accessing data in a managed object forfeits many opportunities for increased performance. Using managed objects should be avoided or used sparingly.
The method also works for adding managed objects implementing IComponentData, but GetComponentData is the preferred method for those objects.