- Home /
Question by
Beta_Artist · Oct 28, 2011 at 12:54 AM ·
texturearrayrandomspawn
Random textures...
I'm looking to have characters spawn with a random texture that I have stored in a array. How would I go about making the array and how would I have the texture be chosen at random when the object is spawned?
Comment
Answer by syclamoth · Oct 28, 2011 at 12:28 AM
Have you searched for 'Random' in the script reference? Because that basically tells you how to do it.
Make an array of Texture2D on your object, then to get a random one use
textures[Random.Range(0, textures.Length)];
where textures is the name of the array.
Your answer
Follow this Question
Related Questions
random spawn locations.... 2 Answers
Multiple spawn points using Array... 1 Answer
Calling random functions 4 Answers
Select from an array based on values 1 Answer
move gameobject into a random position and the spawn an enemy 1 Answer