/// <summary> /// 加载标注 /// </summary> /// <param name="downLoad_name">标注ab</param> public void Load_ps(string downLoad_name, string ab_path) { #if UNITY_EDITOR || UNITY_STANDALONE_WIN var local_db = new DbRepository <Abfiles>(); string temp_path = PublicClass.tempPath + "temp.dat"; local_db.DataService("vesali.db"); Abfiles res = local_db.SelectOne <Abfiles>((temp) => { if (temp.file_name == Vesal_DirFiles.get_file_name_from_full_path(ab_path)) { return(true); } else { return(false); } }); local_db.Close(); if (res == null || !File.Exists(ab_path)) { if (PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.plugin) { try { curBundleObj = LoadPSModel(LoadModel_ppt.url, LoadModel_ppt.password, LoadModel_ppt.sceneName); } catch (Exception e) { Debug.Log(e.Message); } } } else { //解压ab文件 psmodel = null; ReadTextureAB(PublicClass.filePath + "sign/"); Vesal_DirFiles.GetAbfile_Synchronize(ab_path, temp_path); curBundleObj = AssetBundle.LoadFromFile(temp_path); } GameObject realObj = (GameObject)curBundleObj.LoadAsset(downLoad_name, typeof(GameObject)); CurrentObj = Instantiate(realObj); CurrentObj.name = "temp_parent"; CurrentObj.name = CurrentObj.name.Replace("(Clone)", ""); // realObj.transform.SetParent(Transform_parent); // Camera.main.GetComponent<ChooseModel>().SetCameraPosition(CurrentObj.transform); Reset(); GetMaterialsFromModel(downLoad_name); curBundleObj.Unload(false);//卸载内存中的资源 if (File.Exists(temp_path)) { Vesal_DirFiles.DelFile(temp_path); } #elif UNITY_ANDROID || UNITY_IOS downLoad_name = GetSAFromSignidTable(PublicClass.app.struct_name); curBundleObj = AssetBundle.LoadFromFile(PublicClass.filePath + "Android_sign/" + downLoad_name + ".assetbundle"); GameObject realObj = (GameObject)curBundleObj.LoadAsset(downLoad_name, typeof(GameObject)); CurrentObj = Instantiate(realObj); CurrentObj.name = "temp_parent"; CurrentObj.name = CurrentObj.name.Replace("(Clone)", ""); Reset(); GetMaterialsFromModel(downLoad_name); curBundleObj.Unload(false); //卸载内存中的资源 #endif }