Setting the render queue for Standard shader

Is Unity going to update the StandardShaderGUI to give us the option for setting the render queue of a material?
Like this:

3321726--258551--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/issues/selecting-shader-for-a-material-resets-custom-render-queue-to-default-shader-value__

.

2 Likes

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.

3484808–277296–StandardShaderGUI.cs (21.8 KB)

10 Likes

I’m curious as to why this isn’t included in unity 2017-2018-2019 ? Why isn’t this field public anymore ?

3 Likes

It works but not with the Autodesk interactive shader? which is the standard roughness but renamed.

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.

3 Likes

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.

“Does it still remain the custom render queue” - it changes back from what I remember.

How’s this still not added :/?

4 Likes

Yeah it still changes back…

// Wildstyle

2 Likes

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.

2 Likes

Render Queue selector on the Standard Shader is hidden because there’s a setting (blend mode) that overrides it.

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

This fix will (a) expose the render queue in the Standard Shader UI and (b) allow to control it as long as it’s within the correct range for the selected blend mode.

1 Like

Awesome! Thank you. I’ll wait for 2021.1

Cheers and have a great day,
Charles

This is a super annoying limitation of the standard shader but in the meantime, here’s a sloppy workaround. Tested on 2019.3.9f

using UnityEngine;

public class ChangeRenderQueue : MonoBehaviour
{
    public int renderQueue = 1997;
    public MeshRenderer mr;

    // workaround for simply changing the render queue of a material because unity is broke

    void Start()
    {
        mr.sharedMaterial.renderQueue = renderQueue;
    }
}

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)

2 Likes

THANKS A LOT!

But it will reset after select the preset file.

1 Like

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.

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:

if (material.renderQueue < (int)UnityEngine.Rendering.RenderQueue.Transparent)
material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;

In case any of you want to try it go to History for Editor/Mono/Inspector/StandardParticlesShaderGUI.cs - Unity-Technologies/UnityCsReference · GitHub and download and change the one that fits your unity version.

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.

1 Like