protected override void OnUpdate() { Entities.ForEach((Entity e, ref RigSpawner spawner) => { if (EntityManager.HasComponent <RigDefinitionSetup>(spawner.RigPrefab)) { var rigDefinition = EntityManager.GetComponentData <RigDefinitionSetup>(spawner.RigPrefab); if (!rigDefinition.Value.IsCreated) { throw new System.ObjectDisposedException("RigDefinition is not Created"); } RigEntityBuilder.SetupRigEntity(spawner.RigPrefab, EntityManager, rigDefinition.Value); } for (var x = 0; x < spawner.CountX; x++) { for (var y = 0; y < spawner.CountY; ++y) { var rigInstance = EntityManager.Instantiate(spawner.RigPrefab); var position = new float3(x * 1.3F, 0, y * 1.3F); EntityManager.SetComponentData(rigInstance, new Translation { Value = position }); if (m_Input != null) { m_Input.RegisterEntity(rigInstance); } } } EntityManager.DestroyEntity(e); }); }
protected override void OnUpdate() { CompleteDependency(); Entities .WithoutBurst() .WithStructuralChanges() .ForEach((Entity e, ref RigSpawner spawner) => { for (var x = 0; x < spawner.CountX; x++) { for (var y = 0; y < spawner.CountY; ++y) { var rigInstance = EntityManager.Instantiate(spawner.RigPrefab); var translation = new float3(x * 1.3F, 0, y * 1.3F); EntityManager.SetComponentData(rigInstance, new Translation { Value = translation }); if (m_Input != null) { m_Input.RegisterEntity(rigInstance); } } } EntityManager.DestroyEntity(e); }).Run(); }
protected override void OnUpdate() { Entities.ForEach((Entity e, ref RigSpawner spawner) => { for (var x = 0; x < spawner.CountX; x++) { for (var y = 0; y < spawner.CountY; ++y) { var rigInstance = EntityManager.Instantiate(spawner.RigPrefab); var position = new float3(x * 1.3F, 0, y * 1.3F); EntityManager.SetComponentData(rigInstance, new Translation { Value = position }); if (m_Input != null) { m_Input.RegisterEntity(rigInstance); } } } EntityManager.DestroyEntity(e); }); }