How to Count Builders, Friendly & Enemy Units

To determine the overall unit count you can simply count the number of objects returned int he table when calling game:GetFriendlies(), and vice versa for game:GetEnemies()

To count the builders you would either iterate through the returned items and check each if they were a builder, or you can store the value via a module, and increment and decrement on unit created and unit death events. ( latter would be preferable as it’s far less intensive )

Based on a post on the spring forums