/// <summary> /// /// </summary> /// <param name="index"></param> /// <exception cref="IndexOutOfRangeException"></exception> public unsafe T this[int index] { get { // Direct access to the m_ManagedComponentData for fast iteration // we can not cache m_ManagedComponentData directly since it can be reallocated return((T)m_ManagedComponentStore.m_ManagedComponentData[m_IndexArray[index]]); } set { var iManagedComponent = m_IndexArray[index]; m_ManagedComponentStore.UpdateManagedComponentValue(&iManagedComponent, value, ref *m_EntityComponentStore); m_IndexArray[index] = iManagedComponent; } }
public unsafe T this[int index] { get { // Direct access to the m_ManagedComponentData for fast iteration // we can not cache m_ManagedComponentData directly since it can be reallocated return((T)m_ManagedComponentStore.m_ManagedComponentData[m_IndexArray[index]]); } set { var iManagedComponent = m_IndexArray[index]; #if ENABLE_UNITY_COLLECTIONS_CHECKS if (value != null && typeof(T) != value.GetType()) { throw new ArgumentException($"Assigning component value is of type: {value.GetType()} but the expected component type is: {typeof(T)}"); } #endif m_ManagedComponentStore.UpdateManagedComponentValue(&iManagedComponent, value, ref *m_EntityComponentStore); m_IndexArray[index] = iManagedComponent; } }