Search Unity

Setting the render queue for Standard shader

Discussion in 'Editor & General Support' started by ArachnidAnimal, Dec 13, 2017.

  1. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,815
    Is Unity going to update the StandardShaderGUI to give us the option for setting the render queue of a material?
    Like this:

    renderqueu.jpg

    Most all shader GUIs have this option, except for Unity's standard shader.
    The way that it works now is very confusing.
    The render queue of a material is set in the "Debug" mode view of the inspector. When the inspector is switched back to "Normal" view, the render queues reset to the default values due to the current code in StandardShaderGUI.

    https://issuetracker.unity3d.com/is...s-custom-render-queue-to-default-shader-value





    .
     
    Last edited: Dec 13, 2017
    Kokowolo and markgrossnickle like this.
  2. tomix1024

    tomix1024

    Joined:
    May 5, 2017
    Posts:
    8
    Hi,

    I encountered the same issue and worked around it by modifying the StandardShaderGUI.cs (Included in the "Integrated Shaders" that Unity provides).

    Place the attached StandardShaderGUI.cs into your Assets/Editor/ directory, and it should use the provided GUI instead of Unity's built in GUI.

    EDIT:
    The attached file is based on Unity 2017.2.0f3.
     

    Attached Files:

    jeromeWork, homer_3, ktpttd and 6 others like this.
  3. remiC3D

    remiC3D

    Joined:
    Dec 15, 2017
    Posts:
    30
    I'm curious as to why this isn't included in unity 2017-2018-2019 ? Why isn't this field public anymore ?
     
  4. bdb400

    bdb400

    Joined:
    Aug 16, 2012
    Posts:
    6
    It works but not with the Autodesk interactive shader? which is the standard roughness but renamed.
     
  5. jongorr

    jongorr

    Joined:
    Jan 19, 2018
    Posts:
    1
    Hey y'all. Here's a fix at least for 2019.2.6f1. I'm sure it was available long before this. Just look at your material in debug view. There might be a "custom render queue" field. Note: this isn't your render queue + custom render queue; it's a complete override value.

    upload_2020-1-9_16-31-0.png
     
  6. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,815
    Try it with the Unity Standard shader, not the UI shader. Then switch back to Normal view. Does it still remain the custom render queue? I'm still using Unity 2017 so I can't test it.
     
  7. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,090
    "Does it still remain the custom render queue" - it changes back from what I remember.

    How's this still not added :/?
     
  8. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    Yeah it still changes back...

    // Wildstyle
     
    karthikeyuboosa and DezBoyle like this.
  9. screamingcolor

    screamingcolor

    Joined:
    Jul 28, 2020
    Posts:
    3
    gosh I seriously hate unity sometimes. They ignore serious requests like this one, for years and years. Like WTF. And if there's a good reason it's that way, at least tell us in forums like this.
     
    DezBoyle likes this.
  10. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,014
    Render Queue selector on the Standard Shader is hidden because there's a setting (blend mode) that overrides it.
     
  11. Haze-Games

    Haze-Games

    Joined:
    Mar 1, 2015
    Posts:
    189
    Hi @aleksandrk,

    I have the same issue. Yes, the Blend Mode overrides it. When we need a specific render queue value, we cannot achieve it with Standard Shader. It would be awesome to have a "Custom" dropdown field selection, in which we can then set a custom render queue value that will indeed be saved.

    Thanks,
    Charles
     
  12. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,014
    Haze-Games likes this.
  13. Haze-Games

    Haze-Games

    Joined:
    Mar 1, 2015
    Posts:
    189
  14. DezBoyle

    DezBoyle

    Joined:
    Feb 10, 2013
    Posts:
    5
    This is a super annoying limitation of the standard shader but in the meantime, here's a sloppy workaround. Tested on 2019.3.9f

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class ChangeRenderQueue : MonoBehaviour
    4. {
    5.     public int renderQueue = 1997;
    6.     public MeshRenderer mr;
    7.  
    8.     // workaround for simply changing the render queue of a material because unity is broke
    9.  
    10.     void Start()
    11.     {
    12.         mr.sharedMaterial.renderQueue = renderQueue;
    13.     }
    14. }
    15.  
     
  15. juan-jo

    juan-jo

    Joined:
    May 15, 2010
    Posts:
    162
    As a workaround you can save a preset in the material inspector, then exit debug mode (so Custom Render Queue is rewritten by Blend Mode) and then load the preset. The value set in debug mode is recovered.

    (Tested in Unity 2019.2.21)
     
    sayantoyanc and akduy like this.
  16. sayantoyanc

    sayantoyanc

    Joined:
    Jun 4, 2020
    Posts:
    1
    THANKS A LOT!
     
  17. Yiming075

    Yiming075

    Joined:
    Mar 24, 2017
    Posts:
    33
    But it will reset after select the preset file.
     
    karthikeyuboosa likes this.
  18. Jiaquarium

    Jiaquarium

    Joined:
    Mar 22, 2020
    Posts:
    45
    Just spent entirely way too long on this problem once I upgraded my project.

    In Unity 2021.3 it'll be overridden no matter what, so set
    Sorting Priority
    under Advanced Options on your material – that will adjust the Queue by the value you input.
     
  19. Albertomelladoc

    Albertomelladoc

    Joined:
    Aug 1, 2017
    Posts:
    12
    I was able to fix this by changing the StandardParticlesShaderGUI and forcing it to only change the renderqueue when it was under the correct one for that blend mode. In my case I only want to be able to set it to more than 3000(Transparent) so I did this:
    Code (CSharp):
    1. if (material.renderQueue < (int)UnityEngine.Rendering.RenderQueue.Transparent)
    2. material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;
    In case any of you want to try it go to https://github.com/Unity-Technologi.../Mono/Inspector/StandardParticlesShaderGUI.cs and download and change the one that fits your unity version.
     
  20. Radivarig

    Radivarig

    Joined:
    May 15, 2013
    Posts:
    121
    Does not work in Unity 2022.3, resets back to 2000 immediately.

    I was able to set it to 3000 by additionally setting Saved Properties > Floats > _QueueOffset to 1000.
     
    Last edited: Nov 27, 2023
    marcospgp likes this.
  21. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,014
    Radivarig likes this.
  22. marcospgp

    marcospgp

    Joined:
    Jun 11, 2018
    Posts:
    194
    Has someone reported this as a bug yet? A link to the ticket would be great
     
  23. Radivarig

    Radivarig

    Joined:
    May 15, 2013
    Posts:
    121
    marcospgp likes this.