Some basic questions regarding unity 2d

Hi guys

I got some very basic questions regarding 2d in unity.
I’m looking to create a very simple top-down battleground (rts style), but there are some basics I’m unsure of.

In a game like warcraft 2, are all the units then represented by a sprite?
And if so, when right-clicking in the projects tab, going → create → sprites → cube, I get a white cube, but I can’t find anywhere to change it’s color?
I can change the color if I drag the sprite into the game hierarchy, and then back into the projects tabs to make it a prefab, but is this the way primary way to go?

To begin with, I just want to create cubes colored to represent various units.

Thank you for reading

When you create a sprite through the menu, it gives you a basic primitive sprite texture. It’s as if you imported your own white texture. You can’t change the color of the asset unless you reimport it.

Bringing it into the hierarchy will give it a SpriteRenderer to show the sprite on screen, and SpriteRenderer can tint textures, which is what you are doing. The original texture remains the same.

As for the best practices for an RTS game, I’m not sure. You’ll lose performance if you have tons and tons of SpriteRenderers on screen at the same time, so there are probably other ways to improve performance. But if your game is small scale, I see no reason why SpriteRenderer wouldn’t work. I’ll leave specific answers to someone more knowledgeable about that sort of thing.

I often have hundreds of sprite renderers on screen without it sucking. As long as your sprites are atlased into the same texture, they batch up and render pretty quick. I do use custom shaders, but they only shave off one redundant color multiply compared to the default shader. On a crappy android I do see rendering performance hits when I have a lot of overdraw, sprites piling up with lots of effects and whatnot, but it is not near as bad as I feared before we tested.

The other biggest overhead I see with hundreds of sprites is culling, which seems pointless since everything is in the transparent queue… I do want to port from SpriteRenderers to GL calls to get around the overhead of culling, but that’s for a day more ambitious than today.