//Inside C# Monobehaviour script materialPropertyBlock.Clear(); sr.GetPropertyBlock(materialPropertyBlock); materialPropertyBlock.AddFloat(dissolvePropertyID, dissolveValue); sr.SetPropertyBlock(materialPropertyBlock); //Inside the shader Properties{ [PerRendererData] _SliceAmount("Slice Amount", Float) = 0.5 [PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {} }
针对多个相同材质,不同属性参数设置,减少性能消耗