Unit Groups are a variable that includes an array of units, without actually being an array itself. There are 2 common ways to use unit groups. The first is by using the "Pick every unit in unit group and do Actions" function. This function will take only the units you tell it to from the map, and run an action for each one of those units one at a time. for instance:
-
Events
-

Time - Every 5.00 seconds of the game
-
Conditions
-
Actions
-

Pick every unit in (units owned by (Player 1 (Red))) and do (Actions)
-


Loop - Actions
-



Unit - order (picked unit) to Move to (center of (Playable Map Area))
in this example trigger, every 5 seconds this trigger will pick out every one of reds units. Under the Loop - Actions you see an order to move the units. This actions will go through each of player 1's units, one at a time, and tell it to move to the middle of the map. (picked unit) is the field you use to talk about the units in your newly picked unit group.
The way a pick every unit in unit group works is by getting all the units you tell it to, then it takes those units one at a time and tells them to do the "Loop - Actions". "picked unit" refers to the unit that will be told to do "Loop - Actions"
Now to make a unit group without telling each unit to do something, You will need to make a unit group variable. Go under your variables and make a variable, and under type select Unit Group. For my example, I will use My_UG as the variable. For this example, I am going to add a unit to a unit group each time a certain unit "Castle_01" is attacked.
-
Events
-

Unit - A unit is Attacked
-
Conditions
-

Unit-Type of (Attacked Unit) Equal to (Castle_01)
-
Actions
-

Unit Group - Add (Attacking Unit) to My_UG
Now, there us also a function called "Unit Group - Remove Unit". This will remove a unit only from your unit group. In the above example, anytime a unit attacked Castle_01, it was added to My_UG. now lets say we wanted to remove a unit from that unit group every time it attacked Castle_02. We would do:
-
Events
-

Unit - A unit is attacked
-
Conditions
-

Unit-Type of (attacked unit) Equal to (Castle_02)
-
Actions
-

Unit Group - Remove (attacking unit) from My_UG
NOTE: Remember that using "Unit Group - Remove unit" is not the same as using "Unit - Remove".
-Unit - Remove will remove a unit from the game, which will remove it from the map.
-Unit Group - Remove Unit will only take a unit out of a unit group, you will see no difference in the game when this happens.
Well, I hope this helped you understand better.