I was wondering how I should approach the runtime changes on the game UI when selecting different types of units in a RTS.
For example, in Starcraft, each unit type has its own portrait, attributes, buffs and command cards displayed in the UI. Selecting another unit will update all of these.
I can see two possible solutions:
- Each unit type has its own UI panel created (in memory), and selecting another unit disables the current UI panel and enables the new one.
- There is only one UI panel, and selecting a unit fills the portrait, attributes, command cards, etc. dynamically.
Both solutions seem inefficient. The first may consume too much memory, and the second makes no caching at all. Maybe the way to go would be something in-between, or completely different.
I'm working with Unity, but I think the discussion should stay pretty high level.