Instruction └── EnemyInstruction ← you are here ├── EnemyInstruction_Move ├── EnemyInstruction_Attack ├── EnemyInstruction_Block ├── EnemyInstruction_Shoot └── EnemyInstruction_Wait

Additional Field

FieldTypeDescription
controllerEnemyControllerReference to the enemy running this instruction. Injected at runtime by the task system before Tick() is called. Use it to access position, animations, health, and blocking state.

Inherited Members to Override

MethodDescription
displayNameName shown in the enemy's action HUD indicator during execution.
Execute()Instant effects — deal damage, change state. Can be empty.
Tick(ExecutionContext ctx)Coroutine. Use controller to drive enemy behaviour and ctx.player to read player state.

Example

using System.Collections;
using UnityEngine;

namespace LoopAdventure
{
    public class EnemyInstruction_Heal : EnemyInstruction
    {
        public override string displayName => "Heal";

        public override void Execute()
        {
            controller.GetComponent<EnemyHealth>().Heal(2);
        }

        protected override IEnumerator Tick(ExecutionContext ctx)
        {
            Execute();
            controller.PlayAnimation("Heal");
            yield return new WaitForSeconds(0.8f);
        }
    }
}
💡
Full guide See Create an Enemy Instruction in the Manual for the complete workflow including EnemyAction ScriptableObject setup.