Quantcast
Viewing all articles
Browse latest Browse all 2891

Expecting EOF found 'import' error

with my car checkpoint script I have set it up to load a scene when the player completes 5 laps but for some reason I am getting an error that says expecting EOF found 'import' I grabbed the snippets from another javascript file that works fine with the exact same code here's the checkpoint script: var checkPointArray : Transform[]; //Checkpoint GameObjects stored as an array static var currentCheckpoint : int = 0; //Current checkpoint static var currentLap : int = 0; //Current lap static var startPos : Vector3; //Starting position var lapText : UI.Text; var lapGoal : float = 5; var isRacing : boolean = true; import UnityEngine.SceneManagement; function Start () { //Set a simple visual aid for the Checkpoints for (objAlpha in checkPointArray) { objAlpha.GetComponent.().material.color.a = 0.2; } checkPointArray[0].GetComponent.().material.color.a = 0.8; //Store the starting position of the player startPos = transform.position; } function Update(){ if (isRacing){ if(lapText)lapText.text = currentLap.ToString(); if (currentLap == lapGoal){ Win(); } } } function Win(){ isRacing = false; Debug.Log("Race Won!"); SceneManager.LoadScene("player 1 win"); } here's the script I got the snippets from: import UnityEngine.SceneManagement; var timer : float = 0.0; // begins at this value var timerMax : float = 3.0; // event occurs at this value function Start () { } function Update () { if(GameObject.FindGameObjectsWithTag("Player").length<2) { timer += Time.deltaTime; if (timer >= timerMax) { Debug.Log("timerMax reached !"); SceneManager.LoadScene("erradication game over"); } } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles