Scripting
Attach Script
To update the formation at runtime, first make sure to attach the Formation Manager component to the script you are using.
// Reference to the FormationManager component
[SerializeField] private FormationManager formationManager; GetUnits
The following call retrieves all GameObjects spawned as children of the Formation Manager GameObject.
// Get all units managed by the FormationManager
List<GameObject> units = formationManager.GetUnits();SetState
The following call sets the active state of all GameObjects spawned under the Formation Manager, making them active or inactive based on the given boolean value.
// Set all units to active or passive state
formationManager.SetState(true);UpdateFormation
The following call updates the formation’s count or spacing using the given values; if no values are provided, it uses the settings from the inspector.
// Update the formation layout dynamically
formationManager.UpdateFormation(count, spacing);Last updated