{"name":"units","title":"units","type":"command","url":"https://community.bistudio.com/wiki/units","revid":340313,"updated":"2023-04-29T17:06:31Z","groups":["Groups","Object Detection"],"status":"ok","games":{"ofp":"1.00","ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofp 1.00","arma3_since":"0.50","description":"Returns an array with all the units in the group or unit's group, or all units belonging to a certain side.","syntaxes":[{"syntax":"units type","params":[{"name":"type","type":"Group, Object or Arma 3 v2.02 Side","type_expr":"Group | Object | Side"}],"returns":{"type":"Array of Objects","type_expr":"Array<Object>","description":"if type is a destroyed object, an empty array is returned","text":"Array of Objects - if *type* is a destroyed object, an empty array is returned"},"form":"unary","right":{"text":"type"}}],"examples":[{"code":["_myUnitCount = count units player;"]},{"code":["_isInMyGroup = _soldier1 in units player;"]},{"code":["private _unitsEast = units opfor;"]},{"text":"```sqf\n// both methods are the same, the latter is preferred for performance reason\nunits group player;        // [B Alpha 1-1:1 (R3vo), B Alpha 1-1:2, B Alpha 1-1:3, B Alpha 1-1:4, B Alpha 1-1:5, B Alpha 1-1:6, B Alpha 1-1:7, B Alpha 1-1:8]\nunits player;            // [B Alpha 1-1:1 (R3vo), B Alpha 1-1:2, B Alpha 1-1:3, B Alpha 1-1:4, B Alpha 1-1:5, B Alpha 1-1:6, B Alpha 1-1:7, B Alpha 1-1:8]\n```","code":["// both methods are the same, the latter is preferred for performance reason\nunits group player;\t\t// [B Alpha 1-1:1 (R3vo), B Alpha 1-1:2, B Alpha 1-1:3, B Alpha 1-1:4, B Alpha 1-1:5, B Alpha 1-1:6, B Alpha 1-1:7, B Alpha 1-1:8]\nunits player;\t\t\t// [B Alpha 1-1:1 (R3vo), B Alpha 1-1:2, B Alpha 1-1:3, B Alpha 1-1:4, B Alpha 1-1:5, B Alpha 1-1:6, B Alpha 1-1:7, B Alpha 1-1:8]"]}],"see_also":["group","allGroups","groups","allUnits","playableUnits","switchableUnits","vehicles"],"notes":[{"user":"Kronzky","date":"2009-09-25T01:03:00Z","text":"The returned array on MP clients is not updated when team members die (only when they are deleted). (*Tested on VBS2*)"},{"user":"Ilias38rus","date":"2020-07-03T03:36:00Z","text":"Seems to always return a list with the same order as the leader's squad menu."}]}