void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } //FacebookInit(); //uncomment after importing facebook sdk }
void Awake() { musicVolume = PlayerPrefs.GetFloat("musicVolume", 1); soundsVolume = PlayerPrefs.GetFloat("soundsVolume", 1); // PlayerPrefs.DeleteAll(); if (!mInstance) { mInstance = this; } else { Destroy(this.gameObject); return; } gameSettings = GetComponent <GameSettings>(); loginManager = GetComponent <LoginManager>(); levelData = GetComponent <LevelData>(); levels = GetComponent <Levels>(); levelsData = GetComponent <LevelsData>(); multiplayerData = GetComponent <MultiplayerData>(); energyManager = GetComponent <EnergyManager>(); musicManager = GetComponent <MusicManager>(); soundManager = GetComponentInChildren <SoundManager>(); notifications = GetComponent <Notifications>(); facebookShare = GetComponent <FacebookShare>(); screenManager = GetComponent <ScreenManager>(); challengesManager = GetComponent <ChallengersManager>(); facebookFriends = GetComponent <FacebookFriends>(); tournament = GetComponent <Tournament>(); // levelsData.Init(); DontDestroyOnLoad(this.gameObject); userData = GetComponent <UserData>(); userData.Init(); multiplayerData.Init(); GetComponent <MusicManager>().Init(); Events.ResetApp += ResetApp; }