Exemplo n.º 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.GetControlPointCount())
            {
                DrawSelectedPointInspector();
            }

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