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.
  2. Dismiss Notice

Material custom render queue resets by itself in the editor.

Discussion in 'General Graphics' started by ArachnidAnimal, Aug 21, 2017.

  1. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    In the inspector, you can set a render queue for a material when in "Debug" view of the inspector window.

    The problem occurs when switching back to "Normal" view, the render queue is reset to 3000.




    I proved this in a script. I set the render queue to 3003, then ran the game in the editor. I got the material render queue

    Code (csharp):
    1.  
    2. Update()
    3. {
    4.   MeshRenderer mr = debugItem.GetComponent<MeshRenderer>();
    5.   Material mat = mr.material;
    6.   int renQ = mat.renderQueue;
    7.   Debug.Log(renQ);
    8. }
    9.  
    It continuously prints "3003".
    As soon as I switch to "Normal view", it starts printing "3000" to the console, meaning Unity reset the render queue back to 3000.

    I don't what else I have to do to prove this issue exists.

    It's happening with Unity 2017.1. And it also happened for previous versions of Unity.
    I fail to see what it is I'm doing wrong here.

     
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,438
    Unity implemented a custom material editor for their Standard Shader, that automatically configures the render queue depending on its "Rendering Mode" for example.

    The custom material editor is writing to the materials' renderQueue property every time the material displayed in the Inspector.

    I believe there isn't much you can do. You could download the Material editor source code and change it to your needs. It's available in the Built in Shaders package (Editor/StandardShaderGUI.cs).

    You might want to submit a bug-report letting Unity know that the "Render Queue" is exposed for every shader but the Standard Shader. I believe UT made the "Render Queue" setting available in materials in 5.6, perhaps they just forgot to update their StandardShader material editor to reflect those changes.
     
  3. Xavier78

    Xavier78

    Joined:
    Oct 13, 2013
    Posts:
    40
    I am having the same problem, which their Standard shader when set to Fade will render objects in the wronge order(with object in front behind). using unity 2018.2.3f1.
     
    devotid likes this.
  4. The-Digital-Shaman

    The-Digital-Shaman

    Joined:
    May 22, 2015
    Posts:
    8
    How to enter inspector mode? ctrl + 3 does nothing. Is it limited only to paid version of unity?
     
  5. Yiming075

    Yiming075

    Joined:
    Mar 24, 2017
    Posts:
    29
    You are in inspector mode in default.