Documentation

Unity Engine


Unity Engine


GetComponentOrderVersion

Gets the version number of the specified component type.
Read time 1 minuteLast updated 2 days ago

Definition

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

GetComponentOrderVersion<T>()

Gets the version number of the specified component type.
public int GetComponentOrderVersion<T>()

Returns

Type

Description

intThe current version number.

Remarks

This version number is incremented each time there is a structural change involving the specified type of component. Such changes include creating or destroying entities that have this component and adding or removing the component type from an entity. Shared components are not covered by this version; see EntityManager.GetSharedComponentOrderVersion.
Version numbers can overflow. To compare if one version is more recent than another, directly checking if VersionB is greater than VersionA is not sufficient. Instead, use the helper function:
bool VersionBisNewer = ChangeVersionUtility.DidChange(VersionB, VersionA);

GetComponentOrderVersion(ComponentType)

Gets the version number of the specified component type.
public int GetComponentOrderVersion(ComponentType componentType)

Parameters

componentType

The component type.

Returns

Type

Description

intThe current version number.

Remarks

This version number is incremented each time there is a structural change involving the specified type of component. Such changes include creating or destroying entities that have this component and adding or removing the component type from an entity. Shared components are not covered by this version. EntityManager.GetSharedComponentOrderVersion.
Version numbers can overflow. To compare if one version is more recent than another, directly checking if VersionB is greater than VersionA is not sufficient. Instead, use the helper function:
bool VersionBisNewer = ChangeVersionUtility.DidChange(VersionB, VersionA);