This function return templates of which there are one or more selected, thus reducing the call time when replacing getEntityState.
Some preliminary tests show that selectedUniqueTemplates.some(...) is about a third of the call time (4 us) with respect to entityStates.some(...) (14 us) with 100 identical units selected.
I am not fully convinced this works well enough, because caching templates has its limitations (aura's, upgrades and such) and caching entity states as well (all states are different, when is the state different enough?).
ToDo:
- Implement, find more use cases.