Properties Added to Shader Graph Do not Appear in the Material Inspector

Hello,

I’m working on a modified version of the URP Lit shader, starting with Shader Graph Package > Production Ready Shaders > Lit > URPLit. The issue I’m facing is that any new Texture2D property I add doesn’t appear in the Inspector, despite multiple attempts. I can confirm the properties work because they show up in the Inspector’s debug view and function when I apply a texture there, but they never appear in the standard Inspector view. Below, I’ve provided an example for clarity.

I start with the URPLit from the Production Ready Shaders and add two new properties: Test1 and Test2. Test1 is connected to where Base Map was connected. Test2 is connected to Ambient Occlusion via Sample Texture 2D node. Show In Inspector is on.

But not in normal view

You can see screenshot of Test1, Test2, general view of the graph, graph inspector of Test1 in the link below.

Is this a bug or am I missing something?

sorry for the links instead of embedded images but Unity forum does not allow me to upload more than 1 image and put more than 2 links for some stupid reason.

Here’s a quote from the documentation that explains what you’re running into:

"In order to create a more compact and user-friendly GUI in the material, this shader uses the same Custom Editor GUI that the code version of the Lit shader uses. Open the Graph Inspector and look at the Graph Settings. At the bottom of the list, you’ll see the following under Custom Editor GUI:

    UnityEditor.Rendering.Universal.ShaderGUI.LitShader

This custom GUI script enables the small texture thumbnails and other features in the GUI. If you need to add or remove parameters in the Blackboard, we recommend removing the Custom Editor GUI and just using Shader Graph’s default material GUI instead. The custom GUI depends on the existence of many of the Blackboard parameters and won’t function properly if they’re removed."

To explain this a bit further, I ran into a bit of a dilemma when implementing this shader. On the one hand, I wanted to create a shader that matched the functionality of Lit. But the only way to do that was to use the same Custom Editor GUI file as Lit. But the downside is that the Custom Editor GUI is hard-coded to work with a specific set of parameters. As you have found, it doesn’t allow for additional ones, and stops working if you remove existing ones. Hence the recommendation in the documentation to not use the Custom Editor GUI if you plan to add or remove Blackboard parameters.

2 Likes

Thanks. I can still use debug view as a workaround right? The workflow will be slightly less efficient but the result would be the same, I guess?

For anyone who finds this from searching online like I did:

Ben is talking about this part of the shader graph editor:

You will need to remove the custom editor function here. However, as was also pointed out, this will make your inspector more complicated.

In my case, In order to make the shader work as I was using it before (plus my new additions to the shader) you will have to manually select the checkboxes for “Use Mask Map” “Use Normal Map” and “Use Emissive map” in the inspector after you remove the custom gui declaration

Hope this helps someone else.

2 Likes