Beispiel #1
0
        internal void GetComponentDataArray <T>(ref ComponentChunkIterator iterator, int indexInComponentGroup, int length, out ComponentDataArray <T> output) where T : struct, IComponentData
        {
            iterator.IndexInComponentGroup = indexInComponentGroup;
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            output = new ComponentDataArray <T>(iterator, length, GetSafetyHandle(indexInComponentGroup));
#else
            output = new ComponentDataArray <T>(iterator, length);
#endif
        }
Beispiel #2
0
        internal void GetComponentDataArray <T>(ref ComponentChunkIterator iterator, int indexInComponentGroup,
                                                int length, out ComponentDataArray <T> output) where T : struct, IComponentData
        {
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            var typeIndex     = TypeManager.GetTypeIndex <T>();
            var componentType = ComponentType.FromTypeIndex(typeIndex);
            if (componentType.IsZeroSized)
            {
                throw new ArgumentException($"GetComponentDataArray<{typeof(T)}> cannot be called on zero-sized IComponentData");
            }
#endif

            iterator.IndexInComponentGroup = indexInComponentGroup;
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            output = new ComponentDataArray <T>(iterator, length, GetSafetyHandle(indexInComponentGroup));
#else
            output = new ComponentDataArray <T>(iterator, length);
#endif
        }