public static void Load(this IAddressableLoader loader) { if (loader == null) { UnityEngine.Debug.LogError("<color=red>ERROR:</color> Cannot load null loader without a provided path and group."); return; } AddressableManager.Get().QueueLoader(loader); }
public async Task LoadUICamera() { IAddressableLoader uiCameraLoader = null; uiCameraLoader.Load <GameObject>(UI_CAMERA_PATH, UI_CAMERA_GROUP, OnUICameraLoaded); while (_layerRoot == null) { await Task.Yield(); } }
public async Task LoadDeviceFrame() { IAddressableLoader deviceFrameLoader = null; deviceFrameLoader.Load <DeviceFrame>(DEVICE_FRAME_PATH, DEVICE_FRAME_GROUP, OnDeviceFrameLoaded); while (_layerPrefab == null) { await Task.Yield(); } }
private void LdrOnCompleted(IAddressableLoader loader, AsyncOperationStatus status) { loader.CompletedEvent -= LdrOnCompleted; var atlases = loader.Assets.Where(o => o is SpriteAtlas).Cast <SpriteAtlas>().ToArray(); var sounds = loader.Assets.Where(o => o is AudioSettings).Cast <AudioSettings>().ToArray(); var locales = loader.Assets.Where(IsLocale).Cast <TextAsset>().ToArray(); var windows = loader.Assets.Where(o => (o as GameObject)?.GetComponent <Window>()) .Cast <GameObject>().Select(o => o.GetComponent <Window>()).ToArray(); if (atlases.Length > 0) { foreach (var pair in _delayedAtlasRequests.ToList()) { if (atlases.Any(atlas => { if (atlas.name != pair.Key) { return(false); } pair.Value?.Invoke(atlas); _delayedAtlasRequests.Remove(pair.Key); return(true); })) { Debug.LogFormat("Request for atlas {0} was found and satisfied.", pair.Key); break; } } } foreach (var audioSettings in sounds) { foreach (var pair in audioSettings.Clips) { AudioManager.RegisterClips(pair.Value, pair.Key); } } foreach (var locale in locales) { LocaleService.AddLocaleCsv(locale.text); } foreach (var window in windows) { WindowManager.RegisterWindow(window, true); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); if (!Application.isPlaying) { return; } TestRunner testRunner = target as TestRunner; if (testRunner == null) { return; } IAddressableLoader loader = null; if (GUILayout.Button("Load GameObject")) { loader.Load <GameObject>( "Assets/AddressableLoadManagement/Tests/Loadable/TestAddressablePrefab.prefab", "TestGroup", testRunner.OnGameObjectLoaded); } if (GUILayout.Button("Unload GameObject")) { testRunner.PopTopGameObject().ReleaseAddressable(); } if (GUILayout.Button("Load ScriptableObject")) { loader.Load <TestScriptableObject>( "Assets/AddressableLoadManagement/Tests/Loadable/TestSO.asset", "TestGroup", testRunner.OnSOLoaded); } if (GUILayout.Button("Unload ScriptableObject")) { testRunner.PopTopSO().ReleaseAddressable(); } }
public static void Load <T>(this IAddressableLoader loader, string path, string group, System.Action <T> onLoaded) where T : UnityEngine.Object { loader = new AddressableLoader <T>(path, group, onLoaded); AddressableManager.Get().QueueLoader(loader); }