- Home /
How to make a character of a random color each time the game starts
Hello everyone. I'm not exactly sure how to approach this as I'm a noob. I'm making a third person shooter and I'm using the standard third person character model, as it works pretty well for my game.
However, I want the character to have a random color every time I start the game. I would also like for a prefab which the shooting script shoots out of the character's body, to take the color of the character. That's pretty much it. Can you please help me out with that? Thank you in advance!
I presume you mean fixed $$anonymous$$m colours and not any old random colour?
-You could either have multiple materials for each $$anonymous$$m colour. (Different albedo textures).
you could use an emission map and just modify it's colour. (Glow in the dark colour bands on the model)
you could modify the colour tint on the material, but this may be too simplistic in look.
For either of the options you could keep a list of $$anonymous$$m colour materials and apply them to your character based on the randomly selected $$anonymous$$m.
Or if you actually did want a totally random colour, just modify the material properties ins$$anonymous$$d of swapping materials.
Sorry, I should've been more clear. I actually mean a completely random color. How do I just modify material properties? Is there a simple script I could use for this?
Answer by ForeignGod · Jan 19, 2016 at 09:26 AM
There is many ways to do this.
One way is to use Random.Range(x, x); in the Start function to assign a int variable when your game and script starts.
Then in the Update function check the variable and decide color depending on int value.