public override void OnInspectorGUI()
        {
            // Update client
            serializedObject.Update();

            // Generate the connection dropdown options/content
            var connectionNames = AmqpConfigurationEditor.GetConnectionNames();
            var options         = new List <GUIContent>();

            for (var i = 0; i < connectionNames.Length; i++)
            {
                var cName = connectionNames[i];
                if (string.IsNullOrEmpty(client.Connection) || client.Connection == cName)
                {
                    index = i;
                }
                options.Add(new GUIContent(cName));
            }

            // Connections drop down
            string tooltip = "Select the AMQP connection to use. Connections can be configured in the AMQP/Configuration menu.";

            index = EditorGUILayout.Popup(new GUIContent("Connection", tooltip), index, options.ToArray());

            // If the index has changed, record the change
            if (index != lastIndex)
            {
                Undo.RecordObject(target, "Undo Connection change");
            }

            // Set the connection name based on dropdown value
            client.Connection = connection.stringValue = options[index].text;

            // Draw the rest of the inspector's default layout
            DrawDefaultInspector();

            // Save/serialized modified connection
            serializedObject.ApplyModifiedProperties();

            // Update the last connection index
            lastIndex = index;
        }
        private void OnEnable()
        {
            // Reference the selected client
            client = (AmqpClient)target;

            // Get a reference to the serialized connection property
            connection = serializedObject.FindProperty("Connection");

            // Load configuration data
            AmqpConfigurationEditor.LoadConfiguration();

            // Restore the connection index
            var connectionNames = AmqpConfigurationEditor.GetConnectionNames();

            for (var i = 0; i < connectionNames.Length; i++)
            {
                var cName = connectionNames[i];
                if (connection.stringValue == cName)
                {
                    index = i;
                    break;
                }
            }
        }