- Home /
What is Wrong With This Section of my Script?
function PlayerAnims()
{
if (PlayerState == 0)
{
PlayerAnimSec.animation.CrossFade("IDLE ANIMATION");
}//
else if (PlayerState == 1)
{
PlayerAnimSec.animation.CrossFade("WALKING ANIMATION");
}//
{ else if (PlayerState == 2)
{
PlayerAnimSec.animation.CrossFade("SPRINTING ANIMATION"); }//
}
I am posting this question once more:
Here's what the console says:
Assets/Player ANIMATION.js(44,5): UCE0001: ';' expected. Insert a semicolon at the end.
Assets/Player ANIMATION.js(44,1): BCE0043: Unexpected token: else.
I'm relatively new to programming and Unity3d; so the simpler the better, I've definitely posted the codes right but some of the brackets may have been posted in this forum wrongly; but it should be okay.
Any Ideas? Thanks In Advance!
Answer by Sundar · Oct 16, 2012 at 06:36 PM
Try this
function PlayerAnims()
{
if (PlayerState == 0)
{
PlayerAnimSec.animation.CrossFade("IDLE ANIMATION");
}//
else if (PlayerState == 1)
{
PlayerAnimSec.animation.CrossFade("WALKING ANIMATION");
}//
else if (PlayerState == 2)
{
PlayerAnimSec.animation.CrossFade("SPRINTING ANIMATION");
}//
}
THAN$$anonymous$$S, AFTER DOING THIS I TWEA$$anonymous$$ED THE SETTINGS A LITTLE AND WATCHED THE TUTORIAL AGAIN AND GOT IT! Cheers
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Why is my exit script not working? 2 Answers
What is Wrong With This Script? 3 Answers
OnTriggerEnter firing late? 1 Answer
Climbing script 0 Answers