- Home /
Customise texture colour during gameplay?
Hello I have a 3d model. I wish to allow the user to go into a scene to customize the colour of the texture.... does anyone know how I would do this? Does anyone have code or a tutorial I could use? I have unity pro and apparently thats useful... to do this but no one explained how.
Also I want this info to be stored, so if the user changes the colour to blue, then it will apply it to the character and stay that way even when the user closes and reloads the application.
Help would be much appreciated thank you. :)
have a look on unify wiki, there is a shader that allows you to apply 2 textures at the same time, I'm not sure about this, but you can change one of the textures 2 different coloured textures on-the-fly, or maybe using multicoloured texture as a colour pallette for one of them, but I don't know if the 2 are independent for zoo$$anonymous$$g etc, also the way to show 2 textures at the same time in unity is with alpha channel, although I don't know how yet.
Can you not just change the color on the material?
Answer by robertbu · Feb 23, 2013 at 10:44 PM
If the problem is a "simple" as you describe (i.e. a single color), the easiest way would be to use a shader that makes use of the main color (Material.color) property. You can use PlayerPrefs to save the either a color index (if they selected from a list) or the rgb values.
That sounds like what I need robertbu. I am not experienced at coding however... is there a tutorial anywhere for this???
I'm not aware of any tutorials. To understand the concept:
Create a scene with a cube and a point light illu$$anonymous$$ating the scene.
Create a texture this is mostly or all white.
Create a material and use this texture. The default diffuse shader is good for a start.
Apply this material to a cube.
Select the cube and in the $$anonymous$$esh Renderer section you will see a property called "$$anonymous$$ain Color" click and play with this color.
This property is the one I'm proposing you save. How it behaves will vary based on the shader, so you want to play with different shaders until you find what works for you.
Your answer
Follow this Question
Related Questions
unity pro only, ios splashscreen 1 Answer
I can change the iOS splash screen but I can't change the Android splash screen. Why? 0 Answers
How can I prevent users from skipping video by leaving the app and coming back? 0 Answers
How can I change the colour of part of a texture? 2 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers