Hello everyone! I’m new here!
I need help whit a animation. I wanna the girl from my game eat a food. I’m trying to make a collision between the food and the girl. When collide, the girl will start the animation “eat”. My animation is made whit .png images (it’s a 2D Game).
I make all the transitions:
The parameter “eat” is trigger and the transition from “Any State” to “eat” is it:
The GameObject “girl”:
And the GameObject “food”(the script is here with the name “foodScript”):
And it’s the code from “foodScript” (Java, but no problem with C#):
#pragma strict
var girl : Animation;
function OnTriggerEnter2D(Other : Collider2D)
{
if(Other.gameObject.name == "girl")
{
girl.Play("eat");
}
}
I don’t know why my animation doens’t start… I 'm in it for two days. I looked for answers but found nothing… So… It’s it guys! If anyone can help me, please, do it. I don’t know where i’m going wrong. It’s Unity 5.0.0f4.