Hi to everyone, I’m studying Unity by using Will Goldstone’s Unity Game Development Essentials edited by Packt Publishing Ltd (2009). I’m doing the lesson about the first script making.
I’ve two errors with the script:
Assets/Scripts/PlayerCollisions.js(29,44): BCE0005: Unknown identifier: ‘animName’.
and
Assets/Scripts/PlayerCollisions.js(30,44): BCE0005: Unknown identifier: ‘animName’.
This is the code I wrote:
#pragma strict
private var doorIsOpen : boolean = false;
private var doorTimes : float = 0.0;
private var currentDoor : GameObject;
var doorOpenTime : float = 3.0;
var doorOpenSound : AudioClip;
var doorShutSound : AudioClip;
function Start () {
}
function Update () {
if(doorIsOpen) {
doorTimes += Time.deltaTime;
if(doorTimes > 3){
Door(doorShutSound, false, “doorshut”, currentDoor);
doorTimes = 0.0;
}
}
}
function OnControllerColliderHit(hit : ControllerColliderHit){
if(hit.gameObject.tag == “outpostDoor” doorIsOpen == false){
currentDoor = hit.gameObject;
Door(doorOpenSound, true, “dooropen”, currentDoor);
var animName = new animName();
var thisDoor = new thisDoor();
thisDoor.animation.Play(animName);
}
}
Door(doorShutSound, false, “doorshut”, currentDoor);
function Door(aClip : AudioClip, openCheck : boolean, animName : String, thisDoor : GameObject){
audio.PlayOneShot(aClip);
doorIsOpen = openCheck;
thisDoor.transform.parent.animation.Play(animName);
}
@script RequireComponent(AudioSource)
I don’t understand where is the error
I’ve Unity 3.5.6f4 installed and I use the free version of the software.
Can you help me?
Thanks