static void CharacterCutSceneImport() { var paths = AssetDatabase.GetAllAssetPaths().Where(p => p.StartsWith("Assets/CharacterCutScene/") && p.EndsWith(".prefab")).ToList(); int progress = 0; foreach (string asset in paths) { if (EditorUtility.DisplayCancelableProgressBar("Character CutScene Import", asset, (++progress) / (float)paths.Count)) { Debug.LogWarningFormat("Canceled"); return; } GameObject prefab = (GameObject)AssetDatabase.LoadAssetAtPath(asset, typeof(GameObject)); GameObject obj = PrefabUtility.InstantiatePrefab(prefab) as GameObject; CharacterCutScene ps = obj.GetComponent <CharacterCutScene>(); if (ps == null) { GameObject.DestroyImmediate(obj); continue; } ps.CreateImport(); GameObject.DestroyImmediate(obj); } EditorUtility.ClearProgressBar(); }
public override void OnInspectorGUI() { //base.OnInspectorGUI(); CharacterCutScene character_animation = (CharacterCutScene)target; EditorGUILayout.BeginHorizontal(); // whole if (!EditorUtility.IsPersistent(character_animation)) { if (GUILayout.Button("Create Import")) { character_animation.CreateImport(); CheckAnimations(); } } EditorGUILayout.EndHorizontal(); // whole if (character_animation.Animation == null) { return; } if (s_Animations == null || character_animation.Animation.GetClipCount() != s_Animations.Length) { CheckAnimations(); } EditorGUILayout.BeginVertical(); // whole EditorGUILayout.Separator(); // if (EditorApplication.isPlaying) { if (s_Util.SeparatorToolbarFold("Debug", null)) { if (character_animation != null && character_animation.CurrentState != null) { EditorGUILayout.LabelField(string.Format("{0} : {1}/{2}", character_animation.CurrentState.name, character_animation.PlaybackTime, character_animation.CurrentState.length)); } else { EditorGUILayout.LabelField("none"); } EditorUtility.SetDirty((MonoBehaviour)character_animation); } } // if (EditorApplication.isPlaying == false) { OnInspectorPlay(character_animation); } EditorGUILayout.EndVertical(); // whole if (GUI.changed) { EditorUtility.SetDirty((MonoBehaviour)character_animation); } }