Need help with basic script from Will Goldstone's Book.

Hi,

I am currently learning scripting from Will Goldstone’s book on unity 3.x, and I am lost on a script from the book which is giving me errors.

The errors I am getting are as follows:

1.) Assets/Scripts/Playercollision.js(7,9): BCE0044: expecting }, found ‘private’.

2.) Assets/Scripts/Playerc0ollisions.js(14,1): expecting EOF, found ‘}’.

3.) Assets/Scripts/Playerc0ollisions.js(23,46): UCE001: ‘;’ expected. Insert a semicolon at the end

4.) Assets/Scripts/Playerc0ollisions.js(25,20): expecting :, found ‘=’.

I have googled and researched these but I just dont understand. I dont seem to be missing an simi colons and I dont seem to have more or less brackets than I should. I am LOST!

Here is the script, please help!! :slight_smile: Thank you in advance!

#pragma strict

private var doorIsOpen : boolean = false;
private var doorTimer : float = 0.0;
private var currentDoor : GameObject;
var doorOpenTime : float = 3.0;
var doorOpenSound : AudioClip;
var doorShutSound : AudioClip;

function Update ()
{
}

function OnControllerColliderHit (hit : ControllerColliderHit)
{
if(hit.gameObject.tag == “playerDoor” && doorIsOpen == false)
{
OpenDoor(hit.gameObject);
}

function OpenDoor (door : GameObject)
{
doorIsOpen = true;
door.audio.PlayOneShot(doorOpenSound);
}

}

And I am officially retarded I had a function inside of the brackets of another function. Guess I just had to sleep before I could figure it out. Please remove, thanks!

And I am officially retarded I had a function inside of the brackets of another function. Guess I just had to sleep before I could figure it out. Please remove, thanks!