Unity RTS Engine

  1. Home
  2. Unity RTS Engine
  3. Attack Behavior
  4. Attack Component – General

Attack Component – General

General Settings of the attack component. Units and buildings will be referred to as faction entities.


  1. Is Active: When enabled, the faction entity will be able to engage enemy units and attack them.
  2. Code: A unique code for each attack component allows you to inspect the attack components in the custom attack-related delegate events that the RTS Engine offers.
  3. Icon: An icon that represents this attack (this is only used when the faction entity has more than one attack component attached to it and the icons will be used to draw the tasks with which the player can switch from one attack to another).
  4. Basic: Enable this field if this attack component is the default attack behavior of the faction entity.
  5. Attack Power: This value is used by AI components to assess which attacks are more fatal than others and this is taken into consideration while the NPC faction builds its army. So the higher this value is, the more important this attack is for the NPC faction.
  6. Range Type Code (Units only): Input the code of the range type that the unit belongs to (Range types are explained in the Attack Manager documentation page).
  7. Engage All Types: When enabled then the faction entity will be able to attack all enemy unit and building types. When disabled, the following options should appear:
    1. Engage Units: Enable if the faction entity can engage enemy units.
    2. Engage Buildings: Enable if the faction entity can engage enemy buildings.
    3. Engage In List & Codes List: Input faction entity codes or categories in the Codes List field (pick the type of the code first, either Entity Code or Entity Category) and either enable Engage In List so that the attacker can only attack the faction entities with the codes in the list or disable it to allow the attacker to attack all faction entity types expect the ones that have their codes in the list.
  8. Engage On Assign: Enable if the player can assign targets to the faction entity.
  9. Engage When Attacked: Enable if the faction entity can attack back its attacker when it doesn’t have an already active target.
  10. Engage Once: Enable if the faction entity can only launch an attack and then the target has to be re-assigned.
  11. Engage Friendly: Enable if the faction entity can attack friendly units/buildings.
  12. Move On Attack (Units only): Enable if the unit can launch its attack while moving (towards the target).
  13. Engage In Range: Enable if the faction entity can automatically search for a target and engage it.
  14. Search Range: If engaging in range is enabled, this defines the range in which the faction entity can search for a target.
  15. Search Reload: if engaging in range is enabled, this defines the time reload between each search for a target that the faction entity executes.
  16. Follow Distance (Units only): If the target escapes from the unit, then this value defines the maximum distance that the unit is allowed to follow the target for before it stops the attack.
  17. Direct: Enable this option if the faction entity can apply damage directly to its target. Disable this if the faction entity launches an Attack Object towards the target which will only deal damage in case of collision with the target.
  18. Launch Type: In case the attack is not direct, there’s two possibilities to launch attack objects:
    1. Random: Randomly pick one attack object from the defined sources and launch it for each attack.
    2. In Order: Go through the entire sources list and launch attack objects in the order they have been added to the sources list.
  19. Attack Object Sources: This array defines the attack objects that the faction entity can launch during an attack, for each element assign:
    1. Attack Object: Drag and drop the attack object’s prefab into this field. This is the object that the faction entity will launch during the attack.
    2. Launch Position: The position of this transform is where the attack object will be launched from. Make sure that the transform assigned in this field is a child object of the faction entity’s main object.
    3. Accuracy Modifier: For each axis (x,y and z) assign a positive value if the attack object’s movement is subject to accuracy modification. The higher the value is for each axis, the less accurate the movement of the attack object will eventually be on that axis. This feature is currently available for single player only.
    4. Delay Time: Time in seconds before the attack object assigned to this element is created/launched.
    5. Create In Delay: When enabled and the Delay Time is set, then the attack object will be created when the delay time is going but it will not be moving until the delay time is over.
    6. Damage In Delay: If the attack object can be created in delay and this is enabled then the attack object will be able to apply damage when in delay.
    7. Delay Parent Object: If the attack object can be created in the delay time, this will its parent object during the delay time. Ignore this field if the attack object doesn’t have a parent in delay. As soon as the delay time is over, the attack object will be parent-free and will start moving towards its target.
  20. Delay Duration: Before the attack is launched, a delay time can be assigned in this field to delay the attack. This can be useful in case the unit’s attack animation starts before the actual attack, the delay time can be set to the time required for the animation to reach the attack launch stage.
  21. Delay Trigger Enabled: Enable this option if you’d like to delay the attack launch until it’s triggered using an external component which calls the “TriggerAttack()” method in the attack component.
  22. Trigger Animation In Delay (Units only): Enable this if you’d like to trigger the unit’s attack animation while the delay time is running.
  23. Use Reload: Enable to have a reload time for this attack.
  24. Reload Time: In case attack reload is enabled, this field represents the reload time in seconds.
  25. Cool Down Enabled: When enabled, the faction entity’s attack will enter cool down mode after an attack is launched.
  26. Cool Down Duration: If cool down is enabled, this field is the time duration of the cool down in seconds.
  27. Reload Dealt Damage: The damage that the faction entity deals to its target can be retrieved using the public method “GetDealtDamage()” in the attack component. When this field is enabled, then the dealt damage counter will be reset every time a new target is assigned.
  28. Order Audio: Audio clip played when the faction entity is ordered to attack an enemy faction entity.
  29. Attack Audio: Audio clip played when the attack is launched.
  30. Task UI: Allows to display a dedicated task for the attacker in the task panel when it’s selected.
    1. Enabled: Only when this field is checked will the task be displayed.
    2. Icon: The task’s icon that will be displayed.
    3. Panel Category: In which task panel UI category will the task appear. For more information about UI task panel categories, check out the UI Manager.

How can we help?