RenderMesh not working on Unity 2020.1

Hello,

I have started learning DOTS, and I try to simply display a sprite with the Hybrid Renderer without using Entity conversion.

I have every required package to use ECS, and all is fine when I use MonoBehaviour with a MeshRenderer and a ConvertToEntity component, but when I try to create entities in a pure way, nothing is displayed at screen.

On the Entity Debugger my entity is correctly displayed but nothing is rendered.

Here’s my code:

using Unity.Entities;
using Unity.Rendering;
using Unity.Transforms;
using UnityEngine;

public class GameManager : MonoBehaviour
{
    [SerializeField]
    private Mesh mesh = null;

    [SerializeField]
    private Material material = null;

    private void Start()
    {
        EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;

        EntityArchetype entityArchetype = entityManager.CreateArchetype(
            typeof(LocalToWorld),
            typeof(Translation),
            typeof(RenderMesh)
        );

        Entity entity = entityManager.CreateEntity(entityArchetype);

        entityManager.SetSharedComponentData(entity, new RenderMesh
        {
            mesh = this.mesh,
            material = this.material
        });
    }
}

In my scene I only have a camera (the default one) and a GameObject with the GameManager script on it. The mesh field is a Quad mesh, and the material field is a simple material with shader Unlit/Transparent and a sprite. When I use a MeshRenderer with this mesh and this material all works fine so the problem doesn’t come from them.

I probably made a beginner mistake but I don’t get it. Any help is appreciated :slight_smile: Thank you in advance!

Ok I just found a solution, I need to add a RenderBounds component on recent versions…

2 Likes

Hope this could help other beginners :slight_smile:

It did help, thanks !