Hello gentlemen! Suppose I have a simple static array in a script, and I initialize this array using Awake or Start! Now, suppose that I have other scripts that changes this array in edit mode. The problem is, when I enter play mode the Awake or Start function is called again resetting my array. Does anyone know how to keep the changes after I enter play mode?
Oh, static. Whoops. Static variables don't save their values between editor and game mode (that I"ve found). I think it's because Unity saves variables per-object, not per-class. I use 'singleton objects' instead to get around that: Code (csharp): class Thing extends MonoBehaviour { var instance : Thing; function Start() { instance = this; } var pretendStaticArray : int[]; static function GetStaticArray() : int[] { return instance.pretendStaticArray; } }