"objectName AnimationEvent 'methodName' has no receiver! Are you missing a component?"

I’m making an animation that has an animation event at the end of every loop that calls a function in a script. But I keep getting that error when they loop, and yes, I assigned the script to the animation event in the Inspector.

void IncrementAnimationTimer()
    {
        StartCoroutine(WaitForABit());
    }

    IEnumerator WaitForABit()
    {
        yield return new WaitForSeconds(2.0f);
        anim.SetInteger("Counter", Counter);
    }

Have no idea what’s happening here, maybe I need to assign something else in the Inspector?

1 Like

I don’t know the full context of this, but if it says it has no receiver, then it has no receiver. I suggest using Debug.Log to find out why the receiver isn’t being set.

That error means that the object with the Animator that calls the event doesn’t have the script attached that contains that function. Any chance you forgot to place the script on the gameobject?

Edit: I should clarify how the fields of the event window work to avoid future confusion, as well. The fields below function are for passing values to that function, i.e. for instantiation. Say you wanted to instantiate a prefab with a function like CreateObject(GameObject thingToInstantiate). In the event window you would put “CreateObject” in the Function field and the prefab in the Object field. Then the receiver would have the function called with the prefab passed as the GameObject value thingToInstantiate. The only way this works, though, is if the gameobject with the Animator attached also has the script with the function attached. That’s where it gets the reference from.