I Need Help With My Script
Hey I am making a horror game and I need this hammer to swing. I have this script and fixed a lot of problems with it. I get an error that says the animation state could not be played because it couldn't be found! Here is the script.
var animation_bool : boolean ;
function Update()
{
if (animation_bool == true)
{
GetComponent.<Animation>().Play("HammerHit");
}
if (Input.GetMouseButtonDown(0))
{
animation_bool = true;
}
}
Answer by AshwinTheGammer · Oct 01, 2017 at 04:15 AM
select your 3d model of hammer(default) after that You have to mark your animations as Legacy to use them with the old animation system. Click on your animation in the project view, now in the inspector there is a drop down where you can you select legacy. Hit apply and it should work. here are images : Select rig > animation type and select legacy
else use animator controller.
I tried both scripts I get the same error. I do not know why. Have you tested out the script?
Isn't that the full code... I just need a script so when you right clicked it would play the animation please.
i have edited my previous answer check that i am absolutely sure that it will solve u r problem and don`t forget to mark this answers as accept.
Ok it worked! But the animation keeps repeating. I want it to stop after the whole animation is played also thank you for your help.