public unsafe T GetComponentData <T>() where T : struct, IComponentData { var typeIndex = TypeManager.GetTypeIndex <T>(); if (TypeManager.IsZeroSized(typeIndex)) { throw new ArgumentException($"GetComponentData<{typeof(T)}> can not be called with a zero sized component."); } return(UnsafeUtilityEx.AsRef <T>(Chunk.GetComponentDataWithTypeRO(Index, typeIndex))); }
private unsafe void *GetPtrByTypeIndexRO(int typeIndex) { // TODO: EntityComponentStore->AssertEntityHasComponent(entity, typeIndex); #if ENABLE_UNITY_COLLECTIONS_CHECKS if (TypeManager.IsZeroSized(typeIndex)) { throw new ArgumentException("GetComponentData can not be called with a zero sized component."); } #endif return(Chunk.GetComponentDataWithTypeRO(Index, typeIndex)); }
private unsafe void *GetPtrByTypeIndexRO(int typeIndex) { return(Chunk.GetComponentDataWithTypeRO(EntityIndex, typeIndex)); }