This Array example shows how to activate children using an array of On/Off values.
This article assumes a basic knowledge of the PlayMaker editor (how to add states, actions etc.).
Import ActivateChildrenExampleScene.unitypackage into a PlayMaker project and open the included scene.
We use a Bool Array called ActivateChildren to store the desired On/Off activation state for each child.
You can set the array size to the number of children and set array items to true/false.
Array Get Next
The Array Get Next action lets you quickly loop through an array.
Note that we store the current array item value in an activate variable and also store the index.
In the loop we go to an Activate Child state.
Get Child Num
When run, the FSM loops through the ActivateChildren array and activates each child using the values in the array.
When all items in the array have been used, it goes to a Finished state.
There are always multiple ways to achieve a goal in Unity/PlayMaker. Explore the Array Actions and you'll find other ways to use arrays.
There are also many shortcuts for common scenarios available on the PlayMaker Ecosystem