public static int RecorderKeyField(Rect position, SerializedObject recorderObj, string label, int selectedValue, bool showEditButton = true)
        {
            var list      = recorderObj.FindProperty("dataList");
            var namelist  = new string[list.arraySize + 2];
            var valuelist = new int[list.arraySize + 2];

            namelist[0]  = "none";
            valuelist[0] = -1;
            valuelist[1] = -1;
            for (int i = 0; i < list.arraySize; ++i)
            {
                namelist[i + 2]  = list.GetArrayElementAtIndex(i).FindPropertyRelative("name").stringValue;
                valuelist[i + 2] = i;
            }

            var buttonSpace = showEditButton ? 60f : 0f;
            var returnint   = EditorGUI.IntPopup(new Rect(position.x, position.y + 2f, position.width - buttonSpace, position.height),
                                                 label, selectedValue, namelist, valuelist);

            if (showEditButton)
            {
                var buttonRect = new Rect(position.x + position.width - 50f, position.y, 50f, position.height);
                if (GUI.Button(buttonRect, "Edit"))
                {
                    DataListEditWindow.Create(recorderObj, buttonRect);
                }
            }

            return(returnint);
        }
        public static void Create(SerializedObject handler, Rect buttonRect)
        {
            if (handler == null || handler.targetObject.GetType() != typeof(Recorder))
            {
                return;
            }

            DataListEditWindow window = CreateInstance <DataListEditWindow>();

            window.handler        = handler;
            window.dataList       = RecorderEditor.CreateDataList(handler);
            window.dataList.index = -1;
            window.ShowPopup();
            window.position = new Rect(GUIUtility.GUIToScreenPoint(new Vector2(buttonRect.xMax - WINDOW_WIDTH, buttonRect.yMax)), window.position.size);
            window.Focus();
        }