void LoadTexture(string key, string label) { Addressables.LoadAssets <Texture2D>(new List <object> { key, label }, null, Addressables.MergeMode.Intersection).Completed += TextureLoaded; }
/// <summary> /// Loads all assets of a given label into memory. /// </summary> /// <typeparam name="T">Type of the objects to load.</typeparam> /// <param name="label">Label in the Addressables of the objects to load.</param> /// <returns>Returns a list with elements of type T.</returns> public async Task <List <T> > LoadAssetsByLabel <T>(string label) where T : class { IList <T> objects = new List <T>(100); objects = await Addressables.LoadAssets <T>(label, null); return((List <T>)objects); }
public virtual AssetDatabasePreloadOperation Start(LocalizedAssetDatabase db) { m_Db = db; var loadTablesOperation = Addressables.LoadAssets <LocalizedAssetTable> (new object[] { LocalizedAssetDatabase.AssetTableLabel, LocalizationSettings.SelectedLocale.Identifier.Code }, TableLoaded, Addressables.MergeMode.Intersection); loadTablesOperation.Completed += PreloadTablesCompleted; return(this); }
public PrefabCollection() { Debug.Log("[PrefabCollection ctor] before load async"); AsyncOperation = Addressables.LoadAssets <GameObject>("Prefab", x => { Debug.Log($"[PrefabCollection module async] Prefab {x.Result.name} loaded"); Add((PrefabEnum)Enum.Parse(typeof(PrefabEnum), x.Result.name), x.Result); }); }
static public IEnumerator LoadDatabase() { if (m_CharactersDict == null) { m_CharactersDict = new Dictionary <string, Character>(); yield return(Addressables.LoadAssets <GameObject>("character", op => { Character c = op.Result.GetComponent <Character>(); if (c != null) { m_CharactersDict.Add(c.characterName, c); } })); m_Loaded = true; } }
static public IEnumerator LoadDatabase() { // If not null the dictionary was already loaded. if (themeDataList == null) { themeDataList = new Dictionary <string, ThemeData>(); yield return(Addressables.LoadAssets <ThemeData>("themeData", op => { if (op.Result != null) { themeDataList.Add(op.Result.themeName, op.Result); } })); m_Loaded = true; } }
private static IEnumerator LoadAssetsCore <T>( object key, IObserver <IList <T> > observer, CancellationToken token, Action <IAsyncOperation <T> > onSingleCompleted = null, Action <IAsyncOperation <IList <T> > > onCompleted = null) where T : class { var aop = Addressables.LoadAssets <T>(key, onSingleCompleted); if (onCompleted != null) { aop.Completed += onCompleted; } while (!aop.IsDone && !token.IsCancellationRequested) { yield return(null); } if (token.IsCancellationRequested) { yield break; } observer.OnNext(aop.Result); observer.OnCompleted(); }
public SodaPickupSoundCollection() { AsyncOperation = Addressables.LoadAssets <AudioClip>("SodaPickupSound", x => Add(x.Result)); }
public IAsyncOperation <IList <IResourceLocation> > LoadResourceLocation(object key, List <IResourceLocation> list) { var op = Addressables.LoadAssets <IResourceLocation>(key, x => list.Add(x.Result)); return(op); }
// --------------------------------- public IAsyncOperation <IList <IResourceLocation> > LoadResourceLocation(object key, System.Action <IAsyncOperation <IResourceLocation> > callback) { var op = Addressables.LoadAssets <IResourceLocation>(key, callback); return(op); }
public void LoadEnemyAssets() { Addressables.LoadAssets <IResourceLocation>("Enemy", null).Completed += OnEnemyAssetsLoaded; }
public FootStepSoundCollection() { AsyncOperation = Addressables.LoadAssets <AudioClip>("FootStepSound", x => Add(x.Result)); }
public IAsyncOperation <IList <TObject> > LoadAssets <TObject>(object key, Action <IAsyncOperation <TObject> > callback) where TObject : class { return(Addressables.LoadAssets <TObject>(key, callback)); }
public IAsyncOperation <IList <TObject> > LoadAssets <TObject>(IList <object> keys, Action <IAsyncOperation <TObject> > callback, Addressables.MergeMode mode = Addressables.MergeMode.None) where TObject : class { return(Addressables.LoadAssets <TObject>(keys, callback, mode)); }
void OnEnable() { Addressables.LoadAssets <Sprite>("Obstacle", null).Completed += LoadCompleted; Tools.DestroyOstacleEvent += DestroyObs; // Tools.ToolHitEvent += ToolHit; }
public SceneProfileCollection() { AsyncOperation = Addressables.LoadAssets <SceneProfile>("SceneProfile", x => Add(x.Result)); }
public void LoadDeck(DeckData deckToLoad) { targetDeck = deckToLoad; Addressables.LoadAssets <CardData>(targetDeck.labelsToInclude[0].labelString, null).Completed += OnResourcesRetrieved; }
public PlayerAttackSoundCollection() { AsyncOperation = Addressables.LoadAssets <AudioClip>("PlayerAttackSound", x => Add(x.Result)); }