public IEnumerator CoLoadRes <T>(string addPath) where T : UnityEngine.Object { if (!_Cache.ContainsKey(addPath)) { AddRes addres = new AddRes(); _Cache[addPath] = addres; var load = Addressables.LoadAssetAsync <T>(addPath); yield return(load); addres.OnLoad(load); } else { AddRes addres = _Cache[addPath]; yield return(addres); } }
public AddRes GetRes <T>(string addPath) where T : UnityEngine.Object { if (!_Cache.ContainsKey(addPath)) { AddRes addres = new AddRes(); _Cache[addPath] = addres; var load = Addressables.LoadAssetAsync <T>(addPath); load.Completed += addres.OnLoad <T>; return(addres); } else { AddRes addres = _Cache[addPath]; return(addres); } }