- Home /
Vehicle Enter Script Errors HELP!
I am getting these errors but do not know what is causing this problem could you please help me. I am pretty sure it is just the format of my scripting that is wrong so if anyone could tell me it would be very helpful.
Errors - Assets/Get_In_Vehicle.js(14,10): BCE0044: expecting (, found 'Update'.
Assets/Get_In_Vehicle.js(14,19): UCE0001: ';' expected. Insert a semicolon at the end.
//Boolean
static var playerInVehicle = false;
private var inRange = false;
//Transforms
var Char : GameObject;
var maincamera : Camera;
function Start ()
{
Char = gameObject.Find("Character");
function Update ()
{
var player : Vector3 = Char.transform.position;
var distence : Vector3 = player - transform.position;
if (distence.magnitude < enterDistence)
{
inRange = true;
}
else if (distence.magnitude > enterDistence)
{
inRange = false;
}
if (inRange == true);
{
if (Input.GetKeyUp("return"))
{
if(Get_In_Vehicle.playerInVehicle == true)
{
//Get In Car
}
else if (Get_In_Vehicle.playerInVehicle == false)
{
Get_In_Vehicle.playerInVehicle = true;
gameObject.GetComponent(Car_Movement).enabled = true;
}
}
}
}
}`
The moderator should have asked you to properly format your code. Edit your question and use the "101010" button to make your code look nice and neat.
Do you understand what the compiler errors mean? The numbers in parenthesis tell you where the problem is. (14, 10) means line 14, column 10. You're missing a closing '}' on your Start() function.
thank you and no i dont understand it to well, when they say theres an error on an update function i think i need to remove that function
Your answer
Follow this Question
Related Questions
Reactivating a GameObject that was deactivated from another script 2 Answers
Efficiency of Game Loops 2 Answers
Sharing components amongst different gameobjects 1 Answer
Best way to - Animation Sync - Multiple gameObjects. 0 Answers
Is enabling and disabling a script component with an Update() function in it a good practice? 2 Answers