Exemple #1
0
        //Inspector
        public override void OnInspectorGUI()
        {
            //Loop checkbox
            EditorGUI.BeginChangeCheck();
            bool loop = EditorGUILayout.Toggle("Loop", m_Spline.GetLoop());

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(m_Spline, "Toggle Loop");
                EditorUtility.SetDirty(m_Spline);
                m_Spline.SetLoop(loop);
            }

            //Add curve button
            if (m_SelectedIndex >= 0 && m_SelectedIndex < m_Spline.GetPointCount())
            {
                DrawSelectedPointInspector();
            }

            m_Spline = target as LineSpline;
            if (GUILayout.Button("Add Line"))
            {
                Undo.RecordObject(m_Spline, "Add Line"); //Makes sure we can undo
                EditorUtility.SetDirty(m_Spline);        //Makes sure unity asks us to save after changing
                m_Spline.AddLine();
            }
        }