To be more specific, I made a nice glass container that has some large flattish plates inside that spin around. I create a number of little balls on the inside and the plates mix them all up. Then I have it so you press a button and one ball falls out the bottom and rolls over to you. Is there a way to create and assign a material to each ball as they’re created? I’d like to create a material that has a number “1”, then “2”, then “3” and so on so each ball has a number on it as you probably guessed by now. Is there a way to create the materials with a design like that on the fly? I’m looking for a way to not have to create 300 textures with just a number on it.
Here’s my very generic instantiation code in case it helps
balls = new GameObject[numberOfBalls];
for( int i = 0; i < numberOfBalls; i++ )
{
balls(i) = (GameObject)Instantiate( ballPreFab, new Vector3( Random.Range( -1.3f, 1.3f ), Random.Range( 4.5f, 6.5f ), Random.Range( 1.8f, 4.2f ) ), Quaternion.identity );
}
I don’t know why but putting ‘i’ in brackets next to balls won’t show up so I used parenthesis instead.