示例#1
0
        void PatchEntitiesForPrefab(int *managedComponents, int numManagedComponents, int allocatedCount, int remappingCount, Entity *remapSrc, Entity *remapDst)
        {
#if !NET_DOTS
            for (int i = 0; i < allocatedCount; ++i)
            {
                for (int c = 0; c < numManagedComponents; c++)
                {
                    var managedComponentIndex = managedComponents[c];
                    if (managedComponentIndex != 0)
                    {
                        var obj = m_ManagedComponentData[managedComponentIndex];
                        EntityRemapUtility.PatchEntityForPrefabInBoxedType(obj, remapSrc, remapDst, remappingCount);
                    }
                }
                managedComponents += numManagedComponents;
                remapDst          += remappingCount;
            }
#endif
        }
        public void PatchEntitiesForPrefab(ManagedComponentStore managedComponentStore, Archetype *archetype, Chunk *chunk, int indexInChunk, int entityCount,
                                           EntityRemapUtility.SparseEntityRemapInfo *remapping, int remappingCount, Allocator allocator)
        {
#if !NET_DOTS
            var managedPatches    = archetype->ManagedEntityPatches;
            var managedPatchCount = archetype->ManagedEntityPatchCount;

            // Patch managed components with entity references.
            for (int p = 0; p < managedPatchCount; p++)
            {
                var componentType = managedPatches[p].Type;

                for (int e = 0; e != entityCount; e++)
                {
                    var obj = managedComponentStore.GetManagedObject(chunk, componentType, e + indexInChunk);

                    EntityRemapUtility.PatchEntityForPrefabInBoxedType(obj, remapping + e * remappingCount, remappingCount);
                }
            }
            UnsafeUtility.Free(remapping, allocator);
#endif
        }