// private void GUIRemoveCurrentAnimationButton(HitboxManager m_Target, SerializedProperty Animations) // { // SetEditorColors(Color.red, Color.white); // if (GUILayout.Button("Remove Current Animation") // && EditorUtility.DisplayDialog("Remove " + m_AnimationOptionLabels[SelectedAnimation] + " from " + m_Target.transform.root.name + "?", // "Are you sure you want to remove this animation from " + m_Target.transform.root.name + "? All collider data, movement data, and other custom data for this animation on this character will be deleted.", "Yes", "No")) // { // Animations.MoveArrayElement(SelectedAnimation, Mathf.Max(0, Animations.arraySize - 1)); // Animations.DeleteArrayElementAtIndex(Mathf.Max(0, Animations.arraySize - 1)); // SelectedAnimation = Mathf.Max(0, SelectedAnimation - 1); // } // } /// <summary> /// アタッチされたアニメーターからアニメーション情報を追加取得 /// </summary> /// <param name="Animations"></param> private void GUIAddFromAttachedAnimatorButton(SerializedProperty animations) { SetEditorColors(Color.yellow, Color.white); if (GUILayout.Button("Add All Animations From Attached Animator")) { Animator animator = m_targetManager.GetComponent <Animator>(); AnimationClip[] allclips = animator.runtimeAnimatorController.animationClips; List <AnimationClip> allclipslist = new List <AnimationClip>(allclips); for (int i = 0; i < animations.arraySize; i++) { var currentclip = (AnimationClip)animations.GetArrayElementAtIndex(i).FindPropertyRelative("clip").objectReferenceValue; allclipslist.Remove(currentclip); } for (int i = 0; i < allclipslist.Count; i++) { animations.InsertArrayElementAtIndex(Mathf.Max(0, animations.arraySize - 1)); m_targetObject.ApplyModifiedProperties(); SerializedProperty hitboxData = animations.GetArrayElementAtIndex(animations.arraySize - 1); SerializedProperty clip = hitboxData.FindPropertyRelative("clip"); SerializedProperty frameData = hitboxData.FindPropertyRelative("frameData"); Debug.Log(clip); Debug.Log($"framedata : {frameData}"); clip.objectReferenceValue = allclipslist[i]; for (int k = 0, j = m_targetManager.GetNumFrames(animations.arraySize - 1); k < j; k++) { frameData.InsertArrayElementAtIndex(0); frameData.GetArrayElementAtIndex(0).FindPropertyRelative("collider").ClearArray(); frameData.GetArrayElementAtIndex(0).FindPropertyRelative("events").ClearArray(); } m_targetObject.ApplyModifiedProperties(); } } }