- Home /
'PlayerBlue' AnimationEvent 'InAction' has no receiver! Are you missing a component?
The errors I'm getting:
'PlayerBlue' AnimationEvent 'InAction' has no receiver! Are you missing a component?
'PlayerBlue' AnimationEvent 'AnimationEnd' has no receiver! Are you missing a component?
I don't have much to say for this one, except that I'm setting a boolean "Chopping" to true when the player enters an onTrigger function and resetting a boolean when he exits via an OnExitTigger function. The animation and everything play just fine, everything working as expected, but I get these errors twice per animation loop. Any thoughts? I'll post the code I assume is relevant, but the console isn't even telling me what code I should look in.
using UnityEngine;
using System.Collections;
public class PlayerTriggerAnims: MonoBehaviour
{
// Create a reference to the animator component
private Animator anim;
//These objects are enabled and disabled so that the
//player appears to use the same axe on his back to
//chop the tree down.
public GameObject axeImHolding;
public GameObject axeOnMyBack;
void Start ()
{
anim = GetComponent<Animator>();
}
// check for colliders with a Trigger collider
// if we are entering something called TreeTrigger, set a bool parameter called Chopping to true..
void OnTriggerEnter(Collider col)
{
if (col.gameObject.tag == "TreeTrigger") {
//Make the axe enter my hand.
axeImHolding.transform.renderer.enabled = true;
axeOnMyBack.transform.renderer.enabled = false;
//set the animator bool "chopping" to true so that our chopping animation does play.
anim.SetBool ("Chopping", true);
}
else {
//make the axe stay on my back.
axeImHolding.transform.renderer.enabled = false;
axeOnMyBack.transform.renderer.enabled = true;
}
}
// ..and when leaving the trigger, reset it to false.
void OnTriggerExit(Collider col)
{
if(col.gameObject.tag == "TreeTrigger")
{
//set the animator bool "chopping" to false so that we stop the animation.
anim.SetBool("Chopping", false);
}
}
}
Still no solution to this, would appreciate any insight as to what throws these types of errors so I can debug! Thanks.
Answer by slavo · Sep 05, 2014 at 03:29 PM
My bet is that with "anim.SetBool ("Chopping", true);" you are triggering animation that contains events in it, but you do not consume that events.
For more information on events and how to consume them check:
http://unity3d.com/learn/tutorials/modules/beginner/animation/animation-curves-events
and
http://unity3d.com/learn/tutorials/modules/beginner/animation/animator-scripting
Your answer
![](https://koobas.hobune.stream/wayback/20220613144935im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
OnTriggerEnter Question 2 Answers
Why won't the coin destroy when hit? 0 Answers
OnEnterTrigger wont work 2 Answers
Get a texture to appear, always facing the camera, when a trigger is entered? 1 Answer