void OnWizardOtherButton(){ GameObject[] objects = Selection.gameObjects; int count = 0; foreach (GameObject go in objects) { Undo.RecordObject (go, "change name"); go.name += changeName; count++; EditorUtility.DisplayProgressBar ("进度", count + "/" + objects.Length, (float)count / objects.Length); } EditorUtility.ClearProgressBar ();//关闭进度条 ShowNotification (new GUIContent (Selection.gameObjects.Length + "个物体被修改了")); }
使用EditorUtility的静态方法DisplayProgressBar(标题,提示,进度float)