IEnumerator LoadPrefabModel() { DebugLog.DebugLogInfo("--------487055555555555555555555552800-----" + PublicClass.Transform_parent.transform.Find("framework/GG_LuGu_Diff").childCount); Model_Group = new List <GameObject>(); string temp_path = PublicClass.tempPath + "temp.dat"; AssetBundleCreateRequest assetBundleCreateRequest = null; try { assetBundleCreateRequest = AssetBundle.LoadFromMemoryAsync(Vesal_DirFiles.GetAbfile(PublicClass.filePath + Asset_ab_name, temp_path)); } catch (System.Exception ex) { UnityEngine.Debug.Log(ex.Message); UnityEngine.Debug.Log(ex.StackTrace); } if (assetBundleCreateRequest != null) { yield return(assetBundleCreateRequest); GameObject obj = (GameObject)assetBundleCreateRequest.assetBundle.LoadAsset(Prefab_Inner_name, typeof(GameObject)); realObj = Instantiate(obj); //载入模型的 信息初始化 destory多余脚本 添加block 脚本 Manager_Trans = GameObject.Find(Last_group_name).transform; last_Object = Instantiate(Manager_Trans); last_Object.SetParent(Model_parent, true); last_Object.localPosition = Vector3.zero; last_Object.localScale *= SizeOf_Model; realObj.SetActive(false); Model[] remove_models = last_Object.GetComponentsInChildren <Model>(); List <Model> ya_list = new List <Model>(); for (int i = 0; i < remove_models.Length; i++) { if (remove_models[i].name.Contains("Ya")) { ya_list.Add(remove_models[i]); continue; } Model_Group.Add(remove_models[i].gameObject); } for (int i = 0; i < ya_list.Count; i++) { Destroy(ya_list[i].gameObject); } DebugLog.DebugLogInfo("拼图个数: " + Model_Group.Count); Add_block_componet(Model_Group); BlockManager.Instance.InitTargetPosition();//记录显示模型的初始化位置 //ChangeModel_position(Model_Group);//随机位置 assetBundleCreateRequest.assetBundle.Unload(false); } }