Unity RTS Engine

  1. Home
  2. Unity RTS Engine
  3. Movement Manager

Movement Manager

The Movement Manager component manages unit movement in the game.

When you’re creating a new map using the RTS Engine menu editor, this component is attached to an object called “MovementManager”.

  1. Enable Avoidance: When this is enabled, then units that are not moving will be acting as an obstacle so that other moving units will avoid them calculating their movement paths.
  2. Movement Formation: They define how a group of units pick their target positions when calculating their movement paths. There are currently two types of formations when moving a group of units: Circular and Rectangular. This field allows you to define the movement formation of non-attack units and attack units when they move normally. When attack units are moving towards an attack target, you can define a movement formation for each range type in the Attack Manager component.
    1. Rectangular Formation Parameters:
      1. Units Per Row: Maximum allowed amount of units per row.
      2. Max Empty Rows: Maximum allowed amount of produced empty rows before the formation is switched back to a circular one. This allows to avoid issues where the rectangular formation is not possible to be produced with the current units’ direction and assigned destination position.
  3. Ground/Air Unit Layer Mask: Layer mask that only includes the layer of the object that holds the Target Position Collider for ground/air units. For more information about the Target Position Collider, check out the Unit component documentation page. It’s important that the target position colliders of ground and air units are different to avoid any unwanted movement behavior.
  4. Stopping Distance: When the unit’s distance to its target position reaches this value then the movement will stop and the destination will be marked as reached.
  5. Movement Target Effect: An Effect Object that appears on the destination chosen by the player to move selected unit(s) to.
  6. Terrain Attack Target Effect: An Effect Object that appears on the terrain attack target when the player uses one of its selected units to launch a terrain attack. To enable and to find more information regarding terrain attacks, check Attack Manager.
  7. Path Calculation Max Retries: Because the Unity built-in pathfinding solution (that the RTS Engine uses) is unable to calculate a valid movement path when moving a large group of units towards one destination in the same/consecutive frame, this field defines how many times will the movement manager retry to re-calculate the path to move a unit before it marks the path calculation as failed. The Movement Manager moves one unit per frame.
  8. Unit Height Check Reload: The Unit Movement component of each unit does not update the unit’s position on the y axis (the unit’s height) each frame because that has turned out to be an expensive process. This field defines how often will each moving unit update its height during its movement with 0 being every frame and 1 being once per second.

How can we help?