public void Awake() { if (_isInitialised) { return; } _instance = this; if (_VRAudioManager.HasVRSolutions()) { FabricAudioListener fabricAudioListener = (FabricAudioListener)UnityEngine.Object.FindObjectOfType(typeof(FabricAudioListener)); if (fabricAudioListener != null) { GameObject audioListener = _VRAudioManager.GetAudioListener(); if (audioListener != null) { audioListener.transform.parent = fabricAudioListener.gameObject.transform; } } if (_audioSourcePool == 0) { _audioSourcePool = 100; } } if (_audioSourcePool > 0) { if (_audioSourcePoolManager == null) { _audioSourcePoolManager = base.gameObject.GetComponentInChildren <AudioSourcePool>(); if (_audioSourcePoolManager == null) { _audioSourcePoolManager = AudioSourcePool.Create(); } _audioSourcePoolManager.Initialise(_audioSourcePool, _audioSourcePoolFadeInTime, _audioSourcePoolFadeOutTime); } if (_audioSourcePoolManager != null) { _audioSourcePoolManager.Refresh(); } } InitialiseComponents(); RefreshComponents(); if (_dontDestroyOnLoad) { if (Application.isPlaying) { UnityEngine.Object.DontDestroyOnLoad(base.gameObject); } DebugLog.Print("FabricManager initialised (DontDestroyOnLoad flag enabled)"); } else { DebugLog.Print("FabricManager initialised (DontDestroyOnLoad flag disabled)"); } if (Application.isEditor) { CodeProfiler.enabled = true; FabricManager[] array = UnityEngine.Object.FindObjectsOfType(typeof(FabricManager)) as FabricManager[]; if (array.Length > 1) { DebugLog.Print("More than two FabricManager instances available!!!", DebugLevel.Error); } } for (int i = 0; i < _musicTimeSignatures.Count; i++) { _musicTimeSignatures[i].Init(); } _isInitialised = true; }
private void OnEnable() { AudioSourcePool audioSourcePool = (_instance = FabricManager.Instance.AudioSourcePoolManager); }