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;
}
}
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.