public void LoadModeling(string _path, Dlt_ModelingLoaded _dlt) { if(m_UseAssetBundle == true) StartCoroutine(_LoadModeling_CR(_path, _dlt)); else _dlt(ResourceLoad.CreateGameObject(_path)); }
IEnumerator _LoadModeling_CR(string _path, Dlt_ModelingLoaded _dlt) { while(true) { yield return null; if(s_ModelLoading == false) break; } s_ModelLoading = true; string[] strSplit = _path.Split('/'); string strName = strSplit[strSplit.Length-1].ToLower(); string downloadPath = AssetbundleManager.Instance.GetAssetbundleDownloadPath( strName); int nVersion = AssetbundleManager.Instance.GetCachedVersion( strName); Debug.Log("PreloadManager::_LoadModeling_CR: WWW.LoadFromCacheOrDownload( " + downloadPath + ", " + nVersion + ")"); WWW www = WWW.LoadFromCacheOrDownload( downloadPath, nVersion); yield return www; AssetBundle bundle = www.assetBundle; AssetBundleRequest request = bundle.LoadAsync( strName, typeof( GameObject)); yield return request; GameObject obj = request.asset as GameObject; if( null == obj) { Debug.LogError( "AsPStoreManager::_LoadModeling_CR: There is no [ privateshop.asab ] modeling resource."); obj = GameObject.CreatePrimitive( PrimitiveType.Cube); } GameObject model = Instantiate( obj) as GameObject; if(model == null) Debug.LogError("PreloadManager:: _LoadModeling_CR: invalid path = " + _path); bundle.Unload( false); Debug.Log("PreloadManager::_LoadModeling_CR: CreateMaterial( " + model + ", " + strName + ")"); yield return StartCoroutine( CreateMaterial( model, strName)); _dlt(model); s_ModelLoading = false; }