hi! i am trying to implement singleton class but i am totally confused.
i made a class that i want to use in my project it goes something like this (this is the simplified version):
class EControl{
var state : boolean;
//constructor
function EControl(){
state=false;
}
function getState() : boolean{
return state;
}
}
so i later on i realized that i need to have to access object of this class in more then one script and has to be the same object so the value that is set is the same. i was looking what is available in the forums and i found two resources. this one i dont understand http://www.unifycommunity.com/wiki/index.php?title=AManagerClass and this one
is not working (i get “there is no instance”) http://forum.unity3d.com/viewtopic.php?p=388784#388784
so i would appreciate if someone could explain how to make this work and how to use one object of this class in two separate scripts.
thank you!