Is there a way to dynamically create a texture/material that is a number and attach it to an object?

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.

http://blog.almostlogical.com/2010/08/20/adding-text-to-texture-at-runtime-in-unity3d-without-using-render-texture/

Found this a while back, but never ended up needing it. Remembered it when I read your problem, I think it could help.

I haven’t used it myself, like I said, but as long as you’re fairly comfortable with coding (as I’m hoping you are) then this project/blog post may be exactly what you’re looking for.

Hope it helps!

This looks like exactly what I needed thank you!