Dogan Kirnaz
  • Welcome
  • Getting Started
    • Quickstart
  • Basics
    • Editor
    • Scripting
  • Support
    • Support
Powered by GitBook
On this page
  1. Basics

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);
PreviousEditorNextSupport

Last updated 10 days ago