Where to store a bunch of pre-set variables and constants? (noob question)


  1. I've got about 103 gazillion initialized variables, hashes, arrays and constants along with descriptive notes at the top of my "main" script. Is there something akin to a .h file I can put these away in?

  2. If I put them in a separate script, do I need to then attach them to a gameObject?

  3. If I put them into a separate script, will I have to


103 gazillion times from my actual functions script?

Thanks for any info.


Oops. Not answered. The suggested solution requires re-declaring variables in the main script anyway. Now I'm just duplicating all those variables.

You could do this:


class MainVariables
   var somethingOrOther : int;

Save that in your standard assets, then when you need to access it:


var variables = new MainVariables;
var someVariable : int;

   someVariable = variables.somethingOrOther;