Material Override disappears
Using the UI on Unity 6.2 with Shader Graph 17.2 on a graph with the Material Override enabled makes the override disappear from the inspector.
Hey thanks for letting me know. I haven't tested it with Unity 6+ so I'm guessing that's a new property which I haven't added to the layout since the package recreates it from scratch to draw the custom fields. I'll see if I can handle it cleanly with a compile time condition, however I wanted to ask: is there any benefit to using OpenGraphGUI on 6+? From what I've seen the newer Shader Graph versions actually have custom dropdowns and better material UI which they didn't have before. Because of that, I'm not sure if I would even need the package on 6+, but I haven't made many shaders in that version yet
I found OpenGraphGUI very useful despite the latest improvements in the built-in UI, as it still lacks of titles and hidden parameters and pretty much everything else except for the dropdown menus. Or at least it lacks of a clear way of doing them.
Anyways, would it be possible to hide parameters not only if a texture field is unpopulated but with boolean and/or float values set to off/0 as well?
Speaking about the Material Override: I managed to find a workaround: It's basically removing the custom GUI from the material settings > save the graph > edit the needed values in the inspector > set back the custom GUI. It works, but it's uselessly long.
I found OpenGraphGUI very useful despite the latest improvements in the built-in UI, as it still lacks of titles and hidden parameters and pretty much everything else except for the dropdown menus. Or at least it lacks of a clear way of doing them.
Gotcha, thanks! Glad it's still useful for people.
Anyways, would it be possible to hide parameters not only if a texture field is unpopulated but with boolean and/or float values set to off/0 as well?
Good idea, I checked what it would take to get this working and it took just 4 lines of code thanks to the way I set it up. Here's when the "parent float" is 0:
And when it's 1:
Since bools are just floats internally, it works for both types. I also extended it to work for Vectors as well since it was a small change :)
Speaking about the Material Override: I managed to find a workaround: It's basically removing the custom GUI from the material settings > save the graph > edit the needed values in the inspector > set back the custom GUI. It works, but it's uselessly long.
Ah okay, glad you found a workaround. I'm not quite sure I understand this material override thing yet, are you talking about this Entities Graphics feature or is this a new Shadergraph/URP property that accomplishes something else? It'll take more time to dig through a 6.2 project and do some testing but figured I should ask before getting too far
are you talking about this Entities Graphics feature or is this a new Shadergraph/URP property that accomplishes something else?
It's pretty much the set of values you can find in this pic under 'Options'.
Also, I'm glad that it took that little to add that feature :)
Thanks! With that I was able to track down the exact version of URP that added the feature, it's version 12.0.0. After a lot of research I think I've found what draws the Surface Options in the default URP GUI here. Turns out that they're just regular properties that have the "Hide in inspector" flag enabled so that the BaseShaderGUI can pick them up and render them.
So I don't think I need to check for URP versions at all, I can just check for the special name used by each Surface Option along with the HideInInspector flag and render those above the regular props if they're found. With that I've got this:
It renders the Surface Options when you select the "Allow Material Override" option. But there's a problem... changing these settings don't seem to do anything (i.e. changing surface to Transparent doesn't make it transparent) even though I'm pretty sure they're being updated in the property. Even changing them in the Debug inspector shows that nothing happens:
I'm not sure what kind of magic the default inspector is doing, I've read through the code I linked and there's nothing special about it, they just set the property float value and that's exactly what I'm doing but it doesn't seem to change when I use the custom shader GUI. And for the properties to not do anything when changing their values from the debug inspector either is also weird. Maybe somewhere Unity knows to refresh the "cached shader" or something when these values change because they're not standard material props? I'm honestly not sure, so I'm going to step away from it for now. In the meantime, I pushed my work if you want to check it out: https://github.com/RobProductions/OpenGraphGUI/tree/working-branch
Perhaps it will still be useful in some way, like if you're able to read those properties from the ShaderGraph or in a script...? I guess I'll think on it more and may need some help with it if anyone knows the answer, sorry about that!
No worries! Also I really appreciate the effort you're putting into it!
Now, I've been able to quickly test it out and it behaves even weirder than expected: Not only changing values there doesn't do anything (or so it seems), but setting the options to 'Transparent' (rather than opaque) hides all the other properties.
And it seems to hide some parameters from the OG options:
Now, I've been able to quickly test it out and it behaves even weirder than expected: Not only changing values there doesn't do anything (or so it seems), but setting the options to 'Transparent' (rather than opaque) hides all the other properties.
Thanks for testing it :) That's weird, I don't get that at all on Unity 2022.3... What's happening under the hood is it checking for the existence of each special property by their name and displaying them "manually" with ShaderProperty or EditorGUILayout. If I had to guess as to why it would cut off every other property, it might be the fact that I took a shortcut and assumed Blend Mode and the Blend Specular toggle would be present if Surface Type was. i.e. it encountered a null ref and just stopped drawing at that point. I updated the code to check for null on those too now. I also forgot to comment out a debug log which probably clogged up your console and made it hard to see any errors like this, but I've done that now, sorry about that!
Could you try it and let me know how it works? It should at least not hide all of your regular properties/stuff beneath it, and if that's the case then we know the naming scheme for that property must be different on your version, which would open up a whole other box of complications... one thing at a time lol.
And it seems to hide some parameters from the OG options:
Yeah this part is intentional, I stopped looking for the other property names since they didn't seem as important. Once we somehow find a way to get the surface properties working I can find them and add them to the list at a later time haha. Appreciate the help!
I finally managed to test it out and yes, the transparency doesn't hide all the other properties anymore, but the options still seem to do nothing. Tysm for all your work!
Great thanks for letting me know! I'm a bit busy with things but maybe later this week I'll have some time to investigate how to get the properties working. If you have any suggestions/resources I'm all ears lol. Maybe there's just some trick to the default editor that I need to read more carefully... I'll keep you updated and hope there's a solution!