- Home /
Optimization: Changing the color of a material vs. multiple copies of a material
I've finished all the features for my first game and I'm trying to optimise it for mobile. I've made heavy use of recolouring materials and I've noticed that the mobile shaders don't have that option. Would it be better to stick with standard shaders or create seven different copies of each texture/material in each color?
Answer by Paulius-Liekis · Sep 16, 2014 at 10:10 PM
Better get a shader which supports colors - it will be easier to maintain.
You can try using default shaders - it shouldn't be a problem unless you're doing something heavy. Otherwise get a source of mobile shader that you want and add color parameter yourself.
Answer by image28 · Sep 17, 2014 at 05:14 AM
You can add a few lines to the shader to do this
in the properties section of the shader add _Color ("Colour Overide",Color) = (0,0,0,0)
then add a the variable declartion between the input structs and the surf() function float4 _Color;
then change the line ( if there is one )
o.Albedo.rgb = sometexture.rgb * _Color.rgb
Your answer
Follow this Question
Related Questions
Dynamically assigning a material doesn't work on mobile? 1 Answer
Laying a texture over an entire terrain 1 Answer
How can I edit Material Textures without creating a new Shader?,How to edit Material Texture 1 Answer
What are the difference between between Unlit/color and Sprite/default material shader? 0 Answers
Why do materials created at runtime show up incorrectly in the inspector? 1 Answer