Broxxar / GlowingObjectOutlines

A technique for Glowing Object Outlines in Unity.
The Unlicense
161 stars 50 forks source link

Unity material editor breaks if Metallic texture is set #7

Open Haapavuo opened 5 years ago

Haapavuo commented 5 years ago

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 commented 4 years ago

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

BioeJD commented 4 years ago

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.