- Home /
Question by
San_ihapira · Dec 17, 2012 at 04:28 PM ·
variableresetcounter
I have a variable that does not re-set on the closing of my program, the variable is modified on the trigger enter, why does it not re-set?
This is my code for modifing the variable
var Counter =4;
function OnGUI() {
GUI.Label (Rect (10, 10, 100, 20), Counter.ToString());
}
function Numbers(){
Counter=Counter-1;
print(Counter);
}
This is the code used for the destroying of the preFab
function update(){
if (Counter==0){
Counter=4;
var Destroyed;
var otherScript: Display;
function OnTriggerEnter (hit: Collider) {
otherScript.Numbers();
Destroy(gameObject);
}
Comment