- Home /
Why Unknown identifier?
Hi guys. I'm trying write restart game code when something hit the floor:
function Start(){ var thisLevel : int= Application.loadedLevel; print(thisLevel); }
function OnTriggerEnter (other : Collider) { Application.LoadLevel (thisLevel); }
I got: Assets/-MyScripts/RestartLevel-1.js(7,32): BCE0005: Unknown identifier: 'thisLevel'. Why 'thisLevel' is unknown?
thanks for any answer
Answer by bjarnefisker · Jan 09, 2011 at 10:20 AM
You are declaring "thisLevel" in the local scope of the start function and the variable does not exist anywhere else.
Try the following:
var thisLevel : int;
function Start(){ thisLevel = Application.loadedLevel; print(thisLevel); }
function OnTriggerEnter (other : Collider) { Application.LoadLevel (thisLevel); }
Your answer
Follow this Question
Related Questions
I got a major question 1 Answer
Static variables problem 1 Answer
Unknown Identifier "target" 3 Answers
Unknown Identifier? 1 Answer
BCE0005: Unknown identifier 1 Answer