public IEnumerator MonoLoadByResourcesAsync(string path, Type resType, LoadCallBack callback) { ResourceRequest status = null; try { if (resType == null) { status = Resources.LoadAsync(path); } else { status = Resources.LoadAsync(path, resType); } } catch (Exception e) { Debug.LogError(e); m_loadState.isDone = true; m_loadState.progress = 1; callback(m_loadState, null); yield break; } while (!status.isDone) { m_loadState.UpdateProgress(status); callback(m_loadState, null); yield return(0); } m_loadState.UpdateProgress(status); callback(m_loadState, status.asset); }
public IEnumerator MonoLoadByResourcesAsync(string path, LoadCallBack callback) { ResourceRequest status = Resources.LoadAsync(path); while (!status.isDone) { m_loadState.UpdateProgress(status); callback(m_loadState, null); yield return(0); } m_loadState.UpdateProgress(status); callback(m_loadState, status.asset); }
public IEnumerator MonoLoadByWWWAsync(string url, WWWLoadCallBack callback) { WWW www = new WWW(url); LoadState loadState = new LoadState(); while (!www.isDone) { loadState.UpdateProgress(www); callback(loadState, null); yield return(0); } loadState.UpdateProgress(www); callback(loadState, www); }
public IEnumerator MonoLoadByAssetsBundleAsync(string path, AssetBundleLoadCallBack callback) { AssetBundleCreateRequest status = AssetBundle.LoadFromFileAsync(path); LoadState loadState = new LoadState(); while (!status.isDone) { loadState.UpdateProgress(status); callback(loadState, null); yield return(0); } status.assetBundle.name = path; loadState.UpdateProgress(status); callback(loadState, status.assetBundle); }
public IEnumerator MonoLoadByAssetsBundleAsync(string path, AssetBundleLoadCallBack callback) { #if !UNITY_WEBGL AssetBundleCreateRequest status = AssetBundle.LoadFromFileAsync(path); LoadState loadState = new LoadState(); while (!status.isDone) { loadState.UpdateProgress(status); callback(loadState, null); yield return(0); } if (status.assetBundle != null) { status.assetBundle.name = path; } loadState.UpdateProgress(status); callback(loadState, status.assetBundle); #else WWW www = new WWW(path); LoadState loadState = new LoadState(); while (!www.isDone) { loadState.UpdateProgress(www); callback(loadState, null); yield return(0); } if (www.assetBundle != null) { www.assetBundle.name = path; } loadState.UpdateProgress(www); callback(loadState, www.assetBundle); #endif }
public IEnumerator MonoLoadByResourcesAsync(string path, LoadCallBack callback) { ResourceRequest status = Resources.LoadAsync(path); LoadState loadState = new LoadState(); while (!status.isDone) { loadState.UpdateProgress(status); callback(loadState,null); yield return 0; } loadState.UpdateProgress(status); callback(loadState, status.asset); }
public IEnumerator MonoLoadByAssetsBundleAsync(string path, AssetBundleLoadCallBack callback) { AssetBundleCreateRequest status = AssetBundle.LoadFromFileAsync(path); LoadState loadState = new LoadState(); while (!status.isDone) { loadState.UpdateProgress(status); callback(loadState, null); yield return 0; } status.assetBundle.name = path; loadState.UpdateProgress(status); callback(loadState, status.assetBundle); }