I'm using a custom sprite shader for our project. Sprite Renderer seems to work fine, and the color value gets passed to the material, but for some reason it can't see the color value for Sprite Shape Renderer. I temporarily changed the shader to just return the color value, and you can see the differences in these examples: Sprite Renderer: Sprite Shape Renderer: As illustrated above, it works on sprites, but not with sprite shape. Not sure what's going on. The fragment struct I have is as follows: Code (CSharp): struct appdata { float4 vertex : POSITION; fixed4 color : COLOR; float2 uv : TEXCOORD0; float2 uv2 : TEXCOORD1; float4 normal : NORMAL; }; It seems to work with the Sprites - Default shader, so I'm not sure what I'm doing wrong. Thanks in advance
Of course I find the answer after asking the question. I didn't have _RendererColor defined or used in my shader.
Hi Glaswyll, I have started using spriteshape for a new game and I really like the tool. However, when a custom shader is used, I have the same problem you got. How did you manage to make it work? what is _RendererColor that you used? By the way, my custom shader is build with Amplify shader. Thanks.
Unity's built in sprite renderer uses either the mesh's vertex colors, and/or a float4 _RendererColor; property to set the sprite's color. For the built in sprite renderer, vertex colors are used for batched sprites, and _RendererColor is used for instanced sprites. However the default sprite shader always applies both regardless. It seems SpriteShape uses only makes use of the _RendererColor property, leaving the vertex color unmodified. That means that to support SpriteShape compoents and Sprite Renderer components with a single ASE shader you'll want to add a color material property called _RendererColor and use that and the vertex color to multiply the texture.