示例#1
0
    public override void OnInspectorGUI()
    {
        base.DrawDefaultInspector();

        Cone cone = target as Cone;

        if (cone == null)
        {
            return;
        }

        EditorGUILayout.BeginHorizontal();

        // Rebuild mesh when user click the Rebuild button
        if (GUILayout.Button("Rebuild"))
        {
            // check parameter
            if (cone.CheckParam())
            {
                // update parameter
                cone.UpdateParam(false);
                // build mesh
                cone.BuildMesh();
            }
        }

        // Reset to last successul build parameter
        if (GUILayout.Button("Reset"))
        {
            cone.UpdateParam(true);
        }

        EditorGUILayout.EndHorizontal();
    }