- Home /
UV scroll animation error
Any help with the following error:
The material property is different from already stored property.
I get it when animating the offset value (UV Scroll) in a material to simulate a wave animation
Hi, Yes im using the following shader and animating it with the unity animator component.
 Shader "Dual Texture Blend"
 
 {
     Properties {
         _Color ("Color Tint (RGB)", Color) = (1,1,1,1)
         _$$anonymous$$ainTex ("Texture 01 (RGB)", 2D) = "white" {}
         _$$anonymous$$ainTex2 ("Texture 02 (RGB)", 2D) = "white" {}
         _$$anonymous$$askBlend ("$$anonymous$$ask Blend (L:Tex1 - R:Tex2)", Range (0, 1)) = 0.5
         _AlphaLevel ("Alpha Level", Range (0, 1)) = 0.5
     }
     
     SubShader {
         Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
         LOD 400
         
     CGPROGRA$$anonymous$$
     #pragma surface surf Lambert alpha
     
     sampler2D _$$anonymous$$ainTex, _$$anonymous$$ainTex2;
     fixed3 _Color;
     fixed _AlphaLevel, _$$anonymous$$askBlend;
     
     struct Input {
         fixed2 uv_$$anonymous$$ainTex;
         fixed2 uv_$$anonymous$$ainTex2;
     };
     
     void surf (Input IN, inout SurfaceOutput o) {
         fixed4 tex1 = tex2D(_$$anonymous$$ainTex, IN.uv_$$anonymous$$ainTex);
         fixed4 tex2 = tex2D(_$$anonymous$$ainTex2, IN.uv_$$anonymous$$ainTex2);
         fixed4 mix = lerp(tex1, tex2, _$$anonymous$$askBlend);
         o.Albedo = mix.rgb * _Color.rgb;
         o.Alpha = mix.a * _AlphaLevel;
     }
     ENDCG
     }
 
     FallBack "Transparent/Diffuse"
 }
Answer by Arche-san · Jul 06, 2015 at 02:57 PM
Hey!
I've got the same error when manipulating material shader properties inside an animation.
Here's a step to reproduce it every time :
- I can reproduce this issue only when unity editor is playing at the first time (after the error does not appear anymore). 
- The animation must modify at least 2 properties of the material shader. 
- The game object which contains the animation must be instantiated after the scene loading. 
Here's the shader i'm using to reproduce the error (i'm not a shader expert so the script can contain some mistakes) :
 Shader "error/MaterialProperty"
 {
     Properties
     {
         [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
         _Brightness("Brightness", Range (-2.0,2.0)) = 0
         _ColorAdd ("ColorAdd", Color) = (0,0,0,1)
         _ColorMult ("ColorMult", Color) = (1,1,1,1)
     }
 
     SubShader
     {
         Tags
         { 
             "Queue"="Transparent" 
             "IgnoreProjector"="True" 
             "RenderType"="Transparent" 
             "PreviewType"="Plane"
             "CanUseSpriteAtlas"="True"
         }
 
         Cull Off
         Lighting Off
         ZWrite Off
         Fog { Mode Off }
         Blend One OneMinusSrcAlpha 
 
         Pass
         {
         CGPROGRAM
             #pragma vertex vert
             #pragma fragment frag
             #include "UnityCG.cginc"
 
             struct appdata_t
             {
                 float4 vertex   : POSITION;
                 fixed4 color    : COLOR;
                 float2 texcoord : TEXCOORD0;
             };
 
             struct v2f
             {
                 float4 vertex   : SV_POSITION;
                 fixed4 color    : COLOR;
                 float2 texcoord  : TEXCOORD0;
             };
             
                fixed4 _ColorAdd;
             fixed4 _ColorMult;
             float _Brightness;
 
             v2f vert(appdata_t IN)
             {
                 v2f OUT;
                 OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
                 OUT.texcoord = IN.texcoord;
                 OUT.color = IN.color;
 
                 return OUT;
             }
 
             sampler2D _MainTex;
 
             fixed4 frag(v2f IN) : SV_Target
             {
                 fixed4 c = tex2D(_MainTex, IN.texcoord);
                 c.rgb *= IN.color.rgb * IN.color.a * c.a;
                 c.a *= IN.color.a;
                 return c;
             }
         ENDCG
         }
     }
 }
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                