,UNEXPECTED SYMBOL VAR
i keep getting an unexpected var notification. Does anyone know what is wrong?
var ChController : Transform;
var inside : boolean = false;
var heightFactor : float 0.18501;
private var FPSInput : FPSInputController;
function Start ()
{
FPSInput = GetComponent(FPSInputContoller);
}
function OnTriggerEnter(Col : Collider)
{
if(Col.gameObject.tag == "Ladder")
{
FPSInput.enabled = false;
inside = !inside;
}
{
function Update()
{
if(Col.gameObject == "Ladder")
{
FPSInput.enabled = true;
inside = !inside;
}
}
function Update()
{
if(inside == true && Input.GetKey("w"))
{
ChController.transform.positon += Vector3.up / heightFactor;
}
}
,var ChController : Transform;
var inside : boolean = false;
var heightFactor : float 0.18501;
private var FPSInput : FPSInputController;
function Start ()
{
FPSInput = GetComponent(FPSInputContoller);
}
function OnTriggerEnter(Col : Collider)
{
if(Col.gameObject.tag == "Ladder")
{
FPSInput.enabled = false;
inside = !inside;
}
{
function Update()
{
if(Col.gameObject == "Ladder")
{
FPSInput.enabled = true;
inside = !inside;
}
}
function Update()
{
if(inside == true && Input.GetKey("w"))
{
ChController.transform.positon += Vector3.up / heightFactor;
}
}
,
Answer by Landern · Aug 05, 2016 at 06:02 PM
Line 37, there is a comma, remove it.
Line 73, there is a comma, remove it
Line 3 should be:
var heightFactor : float = 0.18501f;
Line 9 should be:
FPSInput = GetComponent.<FPSInputContoller>(); // so it pulls the specific type.
You have MANY Update functions, you should only have one. Not sure if you copy/pasta'd your code and duplicated it? But all Update functions should be combined and only one should exist.
Edit:
Like this...
var ChController : Transform;
var inside : boolean = false;
var heightFactor : float 0.18501f;
private var FPSInput : FPSInputController;
function Start ()
{
FPSInput = GetComponent.<FPSInputContoller>();
}
function OnTriggerEnter(Col : Collider)
{
if(Col.gameObject.tag == "Ladder")
{
FPSInput.enabled = false;
inside = !inside;
}
{
function Update()
{
if(inside == true && Input.GetKey("w"))
{
ChController.transform.positon += Vector3.up / heightFactor;
}
}
Your answer
Follow this Question
Related Questions
How can i disable/enable slowly the blur effect using the blur script ? 0 Answers
How can i create/spawn some objects and set random angle for each one ? 0 Answers
How can I give each instance a enum mode from another script ? 0 Answers
Can someone please help me find out what wrong with my code. 1 Answer
can i get help please 0 Answers