void tUpdate() { foreach (Object targetObject in targets) { MeshSimplify meshSimplify = targetObject as MeshSimplify; //+ADD添加应用Job for (int ichild = 0; ichild < meshSimplify.transform.childCount; ichild++) { Transform childTrans = meshSimplify.transform.GetChild(ichild); MeshSimplify simplify = childTrans.GetComponent <MeshSimplify>(); if (simplify != null && simplify.GetSimplifyComputeHeap() != null) { ComputeHeap computeHeap = simplify.GetSimplifyComputeHeap(); if (!computeHeap.IsHandle()) { EditorUtility.DisplayProgressBar("ComputeMeshJobExcute", childTrans.gameObject.name, 0f); } if (computeHeap.GetJobHandleIsComplete() && !computeHeap.IsHandle()) { EditorUtility.DisplayDialog("Done", "Done", "Done"); EditorUtility.ClearProgressBar(); computeHeap.JobComputeComplete(); } } } } }
void Update() { if (isClickButton) { for (int i = 0; i < computeMeshGoList.Count; i++) { EditorUtility.DisplayProgressBar("OnComputeMesh", "mesh|" + computeMeshGoList[i] + " " + index, (float)index / computeMeshGoList.Count); GameObject go = computeMeshGoList[i]; if (go == null) { continue; } for (int ichild = 0; ichild < go.transform.childCount; ichild++) { Transform childTrans = go.transform.GetChild(ichild); MeshSimplify simplify = childTrans.GetComponent <MeshSimplify>(); if (simplify != null && simplify.GetSimplifyComputeHeap() != null) { ComputeHeap computeHeap = simplify.GetSimplifyComputeHeap(); if (computeHeap.GetJobHandleIsComplete()) { computeHeap.JobComputeComplete(); index++; } } } } } if (index != 0 && index == computeMeshGoList.Count) { isClickButton = false; index = 0; EditorUtility.ClearProgressBar(); Debug.Log("<color=yellow>所有的模型数据计算完成————————</color>"); } }