public void Start() { if (!varLoaded) { customGameVariables = GameVariables.Instance.gameObject.AddComponent <CustomGameVariables>(); customGameVariables.Load(GameVariables.Instance); GameVariables.Instance = customGameVariables; // Make sure the network uses the new config. I could not find an event that only update the TrackingStation // But I guess something exist for when you update it.... if (CommNetNetwork.Instance != null) { CommNetNetwork.Reset(); } log(customGameVariables.ToString()); // We have to reload everything at each scene changes because the game mess up some of the values... GameEvents.onLevelWasLoaded.Add(LoadUpgradesPricesSceneChange); // The "Switch Editor" button also reset everything GameEvents.onEditorRestart.Add(LoadUpgradesPrices); BreakStuff(); } }
public void Start() { if (!varLoaded) { customGameVariables = GameVariables.Instance.gameObject.AddComponent <CustomGameVariables>(); customGameVariables.Load(GameVariables.Instance); GameVariables.Instance = customGameVariables; // Make sure the network uses the new config. I could not find an event that only update the TrackingStation // But I guess something exist for when you update it.... CommNetNetwork.Reset(); varLoaded = true; log(customGameVariables.ToString()); GameEvents.onLevelWasLoaded.Add(LoadUpgradesPrices); } }