public AvatarLoaderRequest Load(string rABPath, string rAssetName) { var rRequest = new AvatarLoaderRequest(rABPath, rAssetName); rRequest.Start(Load_Async(rRequest)); return(rRequest); }
public IEnumerator Load_Async(AvatarLoaderRequest rRequest) { string rAvatarABPath = rRequest.ABPath; var rAssetRequest = ABLoader.Instance.LoadAsset(rAvatarABPath, rRequest.AssetName, ABPlatform.Instance.IsSumilateMode_Avatar()); yield return(rAssetRequest); if (rAssetRequest.Asset != null) { GameObject rAvatarGo = GameObject.Instantiate(rAssetRequest.Asset) as GameObject; rAvatarGo.name = rAssetRequest.Asset.name; rAvatarGo.transform.position = Vector3.zero; rRequest.AvatarGo = rAvatarGo; } this.UnloadUnusedAvatarAssets(); }
public async Task <AvatarLoaderRequest> Load(string rABPath, string rAssetName) { var rRequest = new AvatarLoaderRequest(rABPath, rAssetName); string rAvatarABPath = rRequest.ABPath; var rAssetRequest = await ABLoader.Instance.LoadAsset(rAvatarABPath, rRequest.AssetName, ABPlatform.Instance.IsSumilateMode_Avatar()); if (rAssetRequest.Asset != null) { GameObject rAvatarGo = GameObject.Instantiate(rAssetRequest.Asset) as GameObject; rAvatarGo.name = rAssetRequest.Asset.name; rAvatarGo.transform.position = Vector3.zero; rRequest.AvatarGo = rAvatarGo; } this.UnloadUnusedAvatarAssets(); return(rRequest); }