Hi,
Is it possible to make a script run at start-up without having to attach to an object ?
Thanks !
system
2
if at the game startup then no but if you have another script that asks for that script then yes. why would you want this?
AaronG
3
You could make a class containing any static settings you want. Kinda like this…
public static class GameConstants {
public static GUISkin UI_SKIN = Resources.Load("Location/Of/Skin/In/Resources/Folder") as GUISkin;
}
Then you could reference that wherever you are setting the GUIskin by writing:
GUI.Skin = GameConstants.UI_SKIN;
…as the class is static and the variable inside is static.
This is how I store a lot of settings for my game so I can just go to this one file and modify the values without having the dig through lots of other classes. The other advantage is that you can keep certain values across classes consistent. 