예제 #1
0
        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)));
        }
예제 #2
0
        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));
        }
예제 #3
0
 private unsafe void *GetPtrByTypeIndexRO(int typeIndex)
 {
     return(Chunk.GetComponentDataWithTypeRO(EntityIndex, typeIndex));
 }