I have not worked with ECS before, so I was following the tutorial by Unity's Mike Geig on Youtube to convert gameObjects to ECS from Unite Copenhagen, and this code does nothing, and there are no errors:
using Unity.Entities;
using Unity.Transforms;
using UnityEngine;
public class SpawnAsteroidECS : MonoBehaviour
{
public GameObject AsteroidPrefab;
EntityManager manager;
Entity AsteroidEntityPrefab;
void Start()
{
manager = World.Active.EntityManager;
AsteroidEntityPrefab = GameObjectConversionUtility.ConvertGameObjectHierarchy(AsteroidPrefab, World.Active);
}
void Update()
{
if (Input.GetKey(KeyCode.Mouse0))
{
for (int i = 0; i < 100; i++)
SpawnTheAsteroids();
}
}
private void SpawnTheAsteroids()
{
Entity asteroid = manager.Instantiate(AsteroidEntityPrefab);
manager.SetComponentData(asteroid, new Translation { Value = transform.position });
manager.SetComponentData(asteroid, new Rotation { Value = Quaternion.identity });
print("Done");
}
}
What am I not doing?
EDIT: The entity debugger does show that there are entities, but i dont actually see it in the game.