Search Unity

'Enemy' AnimationEvent 'Step' on animation 'Walk' has no receiver! Are you missing a component?

Discussion in 'Animation' started by Tomcioo97, Aug 9, 2021.

  1. Tomcioo97

    Tomcioo97

    Joined:
    Jun 17, 2021
    Posts:
    3
    Hi, I've got an enemy (named "Enemy") which has a roaming function, and applied the same animation player has, he is properly walking around with this script, but every step, there is an error:
    'Enemy' AnimationEvent 'Step' on animation 'Walk' has no receiver! Are you missing a component?
    (Sorry for placing two issues in one thread)
    Moreover, I have a problem with a script which should make an enemy follow a player when he enters enemy's collider, but it doesn't work.
    Code (CSharp):
    1. void Update()
    2.     {
    3.         if (isAlive && isTargetInReach)
    4.         {
    5.             followPlayer();
    6.         }
    7.         if (isAlive)
    8.         {
    9.             anim.SetBool("isWalking", agent.hasPath);
    10.            
    11.         }
    12.         Roam();
    13.     }
    As like in the code above, when isAlive and isTargetInReach are true, enemy should follow player. If I remove isTargetInReach, it follows. But the code below which is applied to body of enemy and where "Enemy" is placed into Movement, doesn't even set isTargetInReach true.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class ColliderData : MonoBehaviour
    6. {
    7.     public EnemyMovement movement;
    8.  
    9.     private void OnTriggerEnter(Collider other)
    10.     {
    11.         if(other.gameObject.tag == "Player")
    12.         {
    13.             movement.isTargetInReach = true;
    14.         }
    15.     }
    16.     private void OnTriggerExit(Collider other)
    17.     {
    18.         if (other.gameObject.tag == "Player")
    19.         {
    20.             movement.isTargetInReach = false;
    21.             movement.GoBackToStartingPosition();
    22.         }
    23.     }
    24. }
    25.  
    I checked, every tag is correct.
    What could go wrong, tho?