Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Entity MeshInstanceRenderer Render Layers

Discussion in 'Graphics for ECS' started by Soaryn, Jun 5, 2018.

  1. Soaryn

    Soaryn

    Joined:
    Apr 17, 2015
    Posts:
    328
    I'm only assuming that all the entities rendered via the MeshInstanceRenderer are all on the same render layer at the moment and the ability to change which layer will come later yes?

    This is just a guess as the question regarding Material Property blocks was answered with "later" :)
     
  2. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,554
    The drawing code uses

    Graphics.DrawMeshInstanced(renderer.mesh, renderer.subMesh, renderer.material, m_MatricesArray, length, null, renderer.castShadows, renderer.receiveShadows);
    , and the missing 2 arguments are layer and camera which will gets a 0 and a null. (https://docs.unity3d.com/ScriptReference/Graphics.DrawMeshInstanced.html) (MeshInstanceRendererSystem.cs)

    If there is a place for this data it would easily be in MeshInstanceRenderer and I think it is not difficult for Unity team to add it. (compared to material property block which should require some workflow considerations) But if you need it now it is just a matter of adding one additional int and make your own MeshInstanceRenderer component, copy the drawing code from MeshInstanceRendererSystem.cs and append that int to the arguments.