I'm using Unity ECS entities to draw out some tiles. I would like to determine the layer (or sortOrder) of the rendered tile so that if a tile is placed over another at the same position, the tile with the higher layer value will be visible.
It appears random at the moment. I tried:
entityManager.SetSharedComponentData(entity, new RenderMesh
{
mesh = mesh,
material = mat,
layer = level
});
But it didn't seem to do anything.