Script Code Error

Hello everyone.

I’ve been work on the 3D Platformer Tutorial and was doing good until I hit a problem. I’ve tryed looking for the answer with no luck so my last option is to ask here so here my problem im useing the newest copy of unity3d

On page 97, I’m asked to add code to the LevelStatus script. However, after saving it, I get errors after errors. I copied the script below:

var exitGateway: GameObject; var levelGoal: GameObject; var unlockedSound: AudioClip; var levelCompleteSound: AudioClip; var mainCamera: GameObject; var unlockedCamera: GameObject; var levelCompletedCamera: GameObject; function Awake()} levelGoal.GetComponent(MeshCollider).isTrigger = false; function UnlockLevelExit() { mainCamera.GetComponent(AudioListener).enabled = false; unlockedCamera.active = true; unlockedCamera.GetComponent(AudioListener).enabled = true; exitGateway.GetComponent(AudioSource).Stop(); if (unlockedSound) { AudioSource.PlayClipAtPoint(unlockedSound, unlockedCamera.GetComponent (Transform).position, 2.0); } yield WaitForSeconds(1); exitGateway.active = false; yield WaitForSeconds(0.2); exitGateway.active = true; yield WaitForSeconds(0.2); exitGateway.active = false; levelGoal.GetComponent(MeshCollider).isTrigger = true; yield WaitForSeconds(4); unlockedCamera.active = false; unlockedCamera.GetComponent(AudioListener).enabled = false; mainCamera.GetComponent(AudioListener).enabled = true; }

After saving this i got the following errors

Assets/Scripts/Misc/LevelStatus.js(23,10): BCE0044: expecting (, found 'UnlockLevelExit'. Assets/Scripts/Misc/LevelStatus.js(24,1): BCE0044: expecting :, found '{'.

Can anyone be so kind to help me fix this
thanks in advance

replace

function Awake()
levelGoal.GetComponent(MeshCollider).isTrigger = false;125

with

function Awake(){
levelGoal.GetComponent(MeshCollider).isTrigger = false;
}

this will probably solve the problem.

Sorry for that i fixed that one last night

function Awake(){ levelGoal.GetComponent(MeshCollider).isTrigger = false; }

than i gave me the other 2 errors

Assets/Scripts/Misc/LevelStatus.js(23,10): BCE0044: expecting (, found 'UnlockLevelExit'. Assets/Scripts/Misc/LevelStatus.js(24,1): BCE0044: expecting :, found '{'.

Heres is a copy of the script thats on my game with errors at the bottom

// LevelStatus: Master level state machine script. var exitGateway: GameObject; var levelGoal: GameObject; var unlockedSound: AudioClip; var levelCompleteSound: AudioClip; var mainCamera: GameObject; var unlockedCamera: GameObject; var levelCompletedCamera: GameObject; // This is where info like the number of items the player must collect in order to complete the level lives. var itemsNeeded: int = 20; // This is how many fuel canisters the player must collect. // Awake(): Called by Unity when the script has loaded. // We use this function to initialise our link to the Lerpz GameObject. function Awake(){ levelGoal.GetComponent(MeshCollider).isTrigger = false; { function UnlockLevelExit() { mainCamera.GetComponent(AudioListener).enabled = false; unlockedCamera.active = true; unlockedCamera.GetComponent(AudioListener).enabled = true; exitGateway.GetComponent(AudioSource).Stop(); if (unlockedSound) { AudioSource.PlayClipAtPoint(unlockedSound, unlockedCamera.GetComponent(Transform).position, 2.0); } if (unlockedSound) { AudioSource.PlayClipAtPoint(unlockedSound, unlockedCamera.GetComponent (Transform).position, 2.0); } yield WaitForSeconds(1); exitGateway.active = false; // ... the fence goes down briefly... yield WaitForSeconds(0.2); //... pause for a fraction of a second... exitGateway.active = true; //... now the fence flashes back on again... yield WaitForSeconds(0.2); //... another brief pause before... exitGateway.active = false; //... the fence finally goes down forever! levelGoal.GetComponent(MeshCollider).isTrigger = true; yield WaitForSeconds(4); // give the player time to see the result. // swap the cameras back. unlockedCamera.active = false; // this lets the NearCamera get the screen all to itself. unlockedCamera.GetComponent(AudioListener).enabled = false; mainCamera.GetComponent(AudioListener).enabled = true; }

errors are

Assets/Scripts/Misc/LevelStatus.js(23,10): BCE0044: expecting (, found 'UnlockLevelExit'. Assets/Scripts/Misc/LevelStatus.js(24,1): BCE0044: expecting :, found '{'.