- Home /
Access to the script variable from a script. Javascript
Hi everybody. Now I want to change static variable of CoconutWin.js from MainMenuGUI2.js. Look at this snippet:
> --------MainMenuGUI2.js----------
> >
> > OpenLevel("Island Level");
> > CoconutWin.haveWon = false; //here "CoconutWin" is a script name and
> > //"haveWon" is a static variable
> >
> > --------------------------------
But it doesn't work. Where is the mistake?
No. It simply doesn't work. From other script this approach works, but from $$anonymous$$ain$$anonymous$$enuGUI2.js it doesn't.
If this code is called, variable should be set. What is printed if you put
print(CoconutWin.haveWon);
before and after the line where you set this variable? If you see expected results, then maybe you set it again to true somewhere else in your code?
Thank you for your help. On closer exa$$anonymous$$ation it turned out that the problem lies elsewhere. The code from the book that I've read is not enough thought.
Your answer
Follow this Question
Related Questions
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Setting Scroll View Width GUILayout 1 Answer
UnityScript self.ExampleList.get_(self a) cannot be assigned to 1 Answer
Finding if a specific key contains a specific value in a Hashtable? 1 Answer
reading a .csv file on a mac? 3 Answers