void Awake() { soundMarkers = new List<SoundMarker>(); layoutManager = new LayoutManager(); layoutManager.layoutManagerDelegate = this; layoutManager.LoadSoundMetaFiles(() => { }); layoutManager.LoadCurrentLayout(); // Calls the delegate method LayoutManagerLoadedNewLayout // The below is called in LayoutManagerLoadedNewLayout // layoutManager.LoadSoundClipsForCurrentLayout(() => { }); int numToPreallocate = Mathf.Min(128, Mathf.Max(8, layoutManager.layout.hotspots.Count)); _soundMarkerPooling = new SoundMarkerPooling(numToPreallocate, del: this); }
/// <summary> /// Update the scene data and place the corresponding sources /// </summary> public void LoadLayoutData(System.Action loadComplete = null) { if (_loadingSoundMarkers) { return; } _loadingSoundMarkers = true; #if UNITY_ANDROID Screen.fullScreen = true; #endif loadingOverlayText.text = "Loading... (0%)"; loadingOverlay.gameObject.SetActive(true); // remove the previous // UnloadCurrentSoundMarkers(); _soundMarkerPooling.RecycleAllMarkers(eraseHotspotData: false); // set up all the hotspots layoutManager.LoadCurrentLayout(); if (onDemandIsActive) { loadSoundMarkersOnCoroutine(complete: () => { OnDemandActiveWasChanged(GetCurrentLayout().onDemandActive); Debug.Log("FINISHED loading markers [OnDemand ON]"); #if UNITY_ANDROID Screen.fullScreen = false; #endif _loadingSoundMarkers = false; if (loadComplete != null) { loadComplete(); } }); } else { layoutManager.LoadAllAudioClipsIntoMemory(MainController.soundMarkers, completion: () => { // Load the SoundMarkers on a CoRoutine loadSoundMarkersOnCoroutine(complete: () => { Debug.Log("FINISHED loading clips and markers [OnDemand OFF]"); _loadingSoundMarkers = false; if (loadComplete != null) { loadComplete(); } #if UNITY_ANDROID if (canvasControl.activeScreen == CanvasController.CanvasUIScreen.Kiosk) { return; } Screen.fullScreen = false; #endif }); }); } }