Exemple #1
0
        public unsafe void ClearMissingReferences()
        {
            var e0 = m_Manager.CreateEntity(typeof(EcsTestData), typeof(EcsTestDataEntity));
            var e1 = m_Manager.CreateEntity(typeof(EcsTestData), typeof(EcsTestDataEntity));
            var e2 = m_Manager.CreateEntity(typeof(EcsTestData), typeof(EcsTestDataEntity));

            m_Manager.SetComponentData(e1, new EcsTestDataEntity {
                value0 = 0, value1 = e0
            });
            m_Manager.SetComponentData(e2, new EcsTestDataEntity {
                value0 = 0, value1 = e0
            });
            m_Manager.DestroyEntity(e0);

            var chunk0 = m_Manager.GetChunk(e1);
            var chunk1 = m_Manager.GetChunk(e2);

            Assert.AreEqual(chunk0, chunk1);

            BumpGlobalSystemVersion();

            ChunkDataUtility.ClearMissingReferences(chunk0.m_Chunk);

            AssetHasChangeVersion <EcsTestData>(e1, OldVersion);
            AssetHasChangeVersion <EcsTestDataEntity>(e1, NewVersion);
            AssetHasChunkOrderVersion(e1, OldVersion);
            AssetHasChunkOrderVersion(e2, OldVersion);
        }