- Home /
 
How come edititng "_Glossiness" through script doesn't work?
I am doing this : material.SetFloat ("_Glossiness" , value);
It is LWRP/Lit
Without seeing the script you are running into this issue with I can't say for sure if this is the issue, and I don't know all the properties of a material well enough off the top of my head to know if "_Glossiness" is a default string of a material, but you either never defined what "_Glossiness" is (or at least well enough that it is properly referencing what the material is asking for) or have a value for "value".
Provide your script and I should be able to help out more.
Answer by dan_wipf · Aug 29, 2019 at 04:42 PM
if you look at the shader file of the LWRP Lit Shader you might want to try _Smoothness and not _Glossiness, because it's marked as Obsolete value…
=> Property block of the Shader:
 Shader "Lightweight Render Pipeline/Lit"
 {
     Properties
     {
         // Specular vs Metallic workflow
         [HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0
         
         [MainColor] _BaseColor("Color", Color) = (0.5,0.5,0.5,1)
         [MainTexture] _BaseMap("Albedo", 2D) = "white" {}
 
         _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
 
         _Smoothness("Smoothness", Range(0.0, 1.0)) = 0.5
         _GlossMapScale("Smoothness Scale", Range(0.0, 1.0)) = 1.0
         _SmoothnessTextureChannel("Smoothness texture channel", Float) = 0
 
         [Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0
         _MetallicGlossMap("Metallic", 2D) = "white" {}
 
         _SpecColor("Specular", Color) = (0.2, 0.2, 0.2)
         _SpecGlossMap("Specular", 2D) = "white" {}
 
         [ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0
         [ToggleOff] _EnvironmentReflections("Environment Reflections", Float) = 1.0
 
         _BumpScale("Scale", Float) = 1.0
         _BumpMap("Normal Map", 2D) = "bump" {}
 
         _OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0
         _OcclusionMap("Occlusion", 2D) = "white" {}
 
         _EmissionColor("Color", Color) = (0,0,0)
         _EmissionMap("Emission", 2D) = "white" {}
 
         // Blending state
         [HideInInspector] _Surface("__surface", Float) = 0.0
         [HideInInspector] _Blend("__blend", Float) = 0.0
         [HideInInspector] _AlphaClip("__clip", Float) = 0.0
         [HideInInspector] _SrcBlend("__src", Float) = 1.0
         [HideInInspector] _DstBlend("__dst", Float) = 0.0
         [HideInInspector] _ZWrite("__zw", Float) = 1.0
         [HideInInspector] _Cull("__cull", Float) = 2.0
 
         _ReceiveShadows("Receive Shadows", Float) = 1.0        
         // Editmode props
         [HideInInspector] _QueueOffset("Queue offset", Float) = 0.0
         
         // ObsoleteProperties
         [HideInInspector] _MainTex("BaseMap", 2D) = "white" {}
         [HideInInspector] _Color("Base Color", Color) = (0.5, 0.5, 0.5, 1)
         [HideInInspector] _GlossMapScale("Smoothness", Float) = 0.0
         [HideInInspector] _Glossiness("Smoothness", Float) = 0.0
         [HideInInspector] _GlossyReflections("EnvironmentReflections", Float) = 0.0
     }
 
 
              I have tried "_Smoothness" as well still no luck. Its very weird I've never had this issue before. When I edit the metallic it works but not the smoothness.
just to be sure, you’re sure it’s a runtime script and materials path is allright?
Yes. I Instantiante a new material with the Lit shader. I then apply the modifications to it. Only the smoothness doesn't change.
Your answer