I am curious how i should go about making a minimap. I want to represent the whole battlefield and units as icons based on type. How would i go about doing this? I know i could have a second camera and then make a gui icon above each object that is only rendered for the minimap camera, but how would i then get them to scale? Would this be inefficient on mobile devices? (tegra 2 tablets)? How would i set up a second camera and render it to a texture anyways? How would i also accommodate for enemies units being same guiIcons, but red instead?
That’s more than one question, you’re disqualified!
Just kidding; I’ll try to take these in order, I’m working on the same sort of thing myself right now.
In the minimap, your icons would all be the same size, wouldn’t they?
That’s the way I visualize it working. You just create the icons at the size you want.
When you display GUI elements, you specify what size they will be.
I can’t speak to the specifics of mobiles, I’ve only been developing for PC/Web so far.
As far as the different icons, I’d just create red versions of the icons at the same time as I made the green ones. If you’re using PhotoShop, you can adjust Hue/Saturation/Brightness in one command, and make multiple variations of the same icon.
Then I’d use a Skin for each color. You could squeeze as many versions as you want in one skin by using the Custom slots, but if you make one skin and set it up the way you want, you can just Duplicate it and swap out the textures for the icons.
Then, just before you display an element, you can have a command (this is of course, in your OnGUI function):
GUI.skin = GreenIcons;
You can have an if or switch statement to check a variable on the unit to switch between GreenIcons and RedIcons.