using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEditor; using UnityEngine; [CustomEditor(typeof(KeyFrame))] public class KeyFrameEditor : Editor { KeyFrame inst; private void OnEnable() { inst = target as KeyFrame; } public override void OnInspectorGUI() { base.OnInspectorGUI(); // if (GUILayout.Button("AddPoint", GUILayout.Height(50))) { Transform point = Instantiate(inst.points[inst.points.Length - 1], inst.points[inst.points.Length - 1].position, Quaternion.identity, inst.points[inst.points.Length - 1].parent).transform; List listTemp = inst.points.ToList(); listTemp.Add(point); inst.points = listTemp.ToArray(); } GUILayout.Space(10); if (GUILayout.Button("SetKey", GUILayout.Height(50))) { if(inst.index < inst.points.Length - 1) { ++inst.index; } else { inst.index = 0; } // inst.viewPoint.position = inst.points[inst.index].position; Debug.Log("N"); } } }