# Unity conversion of Gameobjects to ECS

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.

• Did you attach that MonoBehaviour to an active game object in your scene? – Philipp Nov 1 '19 at 9:36
• Yes I did attach it on an active object. – MetaMax Nov 1 '19 at 9:42
• It does create entities, but I can't see it in the game. – MetaMax Nov 1 '19 at 9:47
• Does the asteroid prefab show up when you put it into the scene as a regular game object? – Philipp Nov 1 '19 at 10:06
• Yes, I can instantiate it with a normal monobehavior gameobject. I just want to do the same with ECS. – MetaMax Nov 1 '19 at 10:07

Its look like that you have not installed the "Hybrid Renderer" Package.

When you want to convert Game objects to Entities then you have to also install "Hybrid Renderer" from package manager.

1. Open up package manager from Windows -> Package manager.
2. Enable "Show Preview Packages" from Advance tab.

3. Then search "hy" then Install "Hybrid Renderer".

Same thing happen to me and from some where on internet i found this and it resolved my issue immediately.I am sorry i don't have link to it but it workes.

I hope this will help.

• Of course! I knew this, I can't believe I forgot the Hybrid Renderer, Thank you!! – MetaMax Nov 1 '19 at 13:23

I was stuck with this problem for a long time, it seems that for Unity 2020.1.2f1 that I am running, "Hybrid Renderer" did not show up in the Package Manager. Looking at the docs made me think it was now a part of "Universal RP" but installing that did not make a difference. It was first when I manually added "com.unity.rendering.hybrid": "0.8.0-preview.19", to the manifest file that the entities started to render.

Btw, Entites did not show up either in PM, but by installing "Havok Physics for Unity" then it was downloaded as an dependency..