Generating textures at runtime?

I am making a need for speed style game. On awake, all police cars are assigned a unique number 1-999, and they use this number when they speak over radio. The issue is that all police cars have the same number painted on their body because they share a texture. Manually creating textures would require 999 2048x2048 images. Is there a way to generate a number and add it to a unique texture at runtime?

Sure, it’s possible to create a Texture2D from scratch with its constructor and use SetPixels to change the pixels of that constructor. It would be pretty difficult and inefficient to figure out how to render the numbers into this array, though. It would probably be a little easier to create a RenderTexture for each car, draw the normal car texture onto it, then draw the numbers onto that. Either way though, it is going to be quite video-memory-intensive.

The way that is probably the easiest (and most performant) way to achieve this effect would not require generating textures at all. First, have ten textures with the numbers 0-9 styled as desired. Then parent three quads to the car, positioned wherever the number should appear. The textures of those quads can then be changed programmatically. If quads stick out or are too obvious, then the best option is to cut out sections of the car mesh in a 3D editing tool such that they are separate objects when the FBX is imported, editing the UV coordinates so that the number appears correctly in the cut-out section of the mesh.

You could probably create a “3d Text” game object. You I am not sure how that would look visually though.