Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unity material editor breaks if Metallic texture is set #7

Open
Haapavuo opened this issue Mar 16, 2019 · 2 comments
Open

Unity material editor breaks if Metallic texture is set #7

Haapavuo opened this issue Mar 16, 2019 · 2 comments

Comments

@Haapavuo
Copy link

Haapavuo commented Mar 16, 2019

Everything works fine using StandardGlow shader until the Metallic texture is set when using Unity 2018.3.0f2.

After that, editor start spamming the following error into the Console:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.MaterialEditor.GetPropertyRect (UnityEditor.MaterialProperty prop, System.String label, System.Boolean ignoreDrawer) (at C:/buildslave/unity/build/Editor/Mono/Inspector/MaterialEditor.cs:1034)
UnityEditor.MaterialEditor.GetPropertyRect (UnityEditor.MaterialProperty prop, UnityEngine.GUIContent label, System.Boolean ignoreDrawer) (at C:/buildslave/unity/build/Editor/Mono/Inspector/MaterialEditor.cs:1026)
UnityEditor.MaterialEditor.ShaderProperty (UnityEditor.MaterialProperty prop, UnityEngine.GUIContent label, System.Int32 labelIndent) (at C:/buildslave/unity/build/Editor/Mono/Inspector/MaterialEditor.cs:1107)
UnityEditor.StandardShaderGUI.DoSpecularMetallicArea () (at C:/buildslave/unity/build/Editor/Mono/Inspector/StandardShaderGUI.cs:322)
UnityEditor.StandardShaderGUI.ShaderPropertiesGUI (UnityEngine.Material material) (at C:/buildslave/unity/build/Editor/Mono/Inspector/StandardShaderGUI.cs:157)
UnityEditor.StandardShaderGUI.OnGUI (UnityEditor.MaterialEditor materialEditor, UnityEditor.MaterialProperty[] props) (at C:/buildslave/unity/build/Editor/Mono/Inspector/StandardShaderGUI.cs:141)
UnityEditor.MaterialEditor.PropertiesGUI () (at C:/buildslave/unity/build/Editor/Mono/Inspector/MaterialEditor.cs:1606)
UnityEditor.MaterialEditor.OnInspectorGUI () (at C:/buildslave/unity/build/Editor/Mono/Inspector/MaterialEditor.cs:393)
UnityEditor.InspectorWindow.DoOnInspectorGUI (System.Boolean rebuildOptimizedGUIBlock, UnityEditor.Editor editor, System.Boolean wasVisible, UnityEngine.Rect& contentRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1625)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Unity_2019-03-16_15-10-27

@BioeJD
Copy link

BioeJD commented Aug 6, 2019

I'm having this issue with a shader of my own as well.

@BioeJD
Copy link

BioeJD commented Aug 7, 2019

My shader (a different shader based on the Standard) was missing a few properties related to the metal map that are in the current Standard shader. Adding them to my shader fixed this issue.

I added:
_GlossMapScale("Smoothness Scale", Range(0.0, 1.0)) = 1.0
[Enum(Metallic Alpha,0,Albedo Alpha,1)] _SmoothnessTextureChannel ("Smoothness texture channel", Float) = 0

Check for missing properties that would cause an issue when updating the metallic area of the inspector GUI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants