I dont know whats wrong with my script

var Playerstate : float;
var PlayerAnimSec : GameObject;

function Update ()
)
PlayerStateController();
PlayerAnims(); around here is were it is wrong
)

function PlayerStateController()
(
if ((input.GetAxis(“Vertical”)!=0 ||input.Get Axis(“Horizontal”)!=0)
(
if (input.Getbutton(“Sprint”))
(
Playerstate = 2;
)
else
(
Playerstate = 1;
)

)
else
(
Playerstate = 0;
)

)

function PlayerAnims()
(
if (Playerstate == 0)
(
PlayerAnimSec.animation.CrossFade(“Idle Animation”, 0.4);
)
(
else if (Playerstate == 1)
(
PlayerAnimSec.animation.CrossFade(“Walking Animation”, 0.4);
)
else if (Playerstate == 2)
(
PlayerAnimSec.animation.CrossFade(“Sprint Animation”, 0.4);
)

  • Formatted code (looks like there are no curly braces, code is as in the above original post) :

    var Playerstate : float;
    var PlayerAnimSec : GameObject;

    function Update ()
    )
    PlayerStateController();
    PlayerAnims(); around here is were it is wrong
    )

    function PlayerStateController()
    (
    if ((input.GetAxis(“Vertical”)!=0 ||input.Get Axis(“Horizontal”)!=0)
    (
    if (input.Getbutton(“Sprint”))
    ( Playerstate = 2; )
    else
    ( Playerstate = 1; )
    )
    else
    (
    Playerstate = 0;
    )
    )

    function PlayerAnims()
    (
    if (Playerstate == 0)
    (
    PlayerAnimSec.animation.CrossFade(“Idle Animation”, 0.4);
    )
    (
    else if (Playerstate == 1)
    (
    PlayerAnimSec.animation.CrossFade(“Walking Animation”, 0.4);
    )
    else if (Playerstate == 2)
    (
    PlayerAnimSec.animation.CrossFade(“Sprint Animation”, 0.4);
    )

Looks like you are using parentheses when you should use curly brackets.

You code:
function PlayerStateController() ( if … )

Should be:
function PlayerStateController() { if … }

Example for correct way to use them:

function Update ()
{
	if (something == 1) 
	{
		doSomething();
	}
	else
	{
		doSomethinElse();
	}
}

function doSomething()
{
	print("Learing to fly");
}

You might want to learn some basics of coding.

Here is some basics about javascript in Unity:
http://forum.unity3d.com/threads/34015-Newbie-guide-to-Unity-Javascript-(long)