public void CloneManagedComponentsFromDifferentWorld(int *indices, int count, ManagedComponentStore srcManagedComponentStore, ref EntityComponentStore dstEntityComponentStore) { dstEntityComponentStore.AssertNoQueuedManagedDeferredCommands(); ReserveManagedComponentIndicesDirect(count, ref dstEntityComponentStore); for (int i = 0; i < count; ++i) { var obj = srcManagedComponentStore.m_ManagedComponentData[indices[i]]; var clone = CloneManagedComponent(obj); int dstIndex = dstEntityComponentStore.AllocateManagedComponentIndex(); m_ManagedComponentData[dstIndex] = clone; } }
public void UpdateManagedComponentValue(int *index, object value, ref EntityComponentStore entityComponentStore) { entityComponentStore.AssertNoQueuedManagedDeferredCommands(); var iManagedComponent = *index; if (value != null) { if (iManagedComponent == 0) { ReserveManagedComponentIndicesDirect(1, ref entityComponentStore); iManagedComponent = *index = entityComponentStore.AllocateManagedComponentIndex(); } } else { if (iManagedComponent == 0) { return; } *index = 0; entityComponentStore.FreeManagedComponentIndex(iManagedComponent); } m_ManagedComponentData[iManagedComponent] = value; }