My project relies on a few scripts that need to be persistent throughout the whole life of the application, and their function is to basically hold the reference and values of gameobjects and states, so I was wondering:
I have just started thinking about the editor, but apart from the tutorials haven't seen much of them around:
My current scripts rely on dontdestroyonload and they work with it, but I am forced to perform many .Find and .GetComponent to get the references of my scene objects and variables (there's a lot of interaction in all scenes).
asked Aug 12 '11 at 07:39 AM
You can have a class (doesn't have to derive from MonoBehaviour) with public static variables. You can then just access them from everywhere in your project with ClassName.variable, but I don't think you can assign static vars in the editor. Example: