- Home /
Swapping Textures vs Swapping Meshes
I am relatively new to Unity and am looking for some advice for what I need to accomplish.
I need to make a gameobject with parts that cycle through 6 different colors during runtime. There are a few ways I know how to go about this, but I'm not sure which is the best practice and has the least overhead.
Methods I know of:
Use 6 models all using one condensed texture and destroy and instantiate new models as needed to cycle the different colors. (I am running this on iOS and Android devices so constantly instantiating and destroying these gameobjects does not seem like a good idea.)
Use one model and swap between 6 different textures. While this would eliminate overhead from constantly destroying and instantiating new game objects, it requires 6 different textures to be in memory.
Similar to the first example, use one condensed texture for all color states, and have one model with a script that references the meshes of the other 5 models and swaps the model's mesh at runtime.
Any advice as to which method is best is appreciated, or if anyone knows a better way to accomplish this.
Answer by Kryptos · Jan 23, 2012 at 10:52 PM
Have one model, one grayscaled texture and a shader with a color parameter such as VertexColored.
What if I have multiple textures for the same model, not just switching color?
I the geometry is the same, you could achieve this by having several materials and switch from one to the other at runtime.