public void UpdateChannelsView() { // Display the Channels interface. ChannelsSize = Channels.arraySize; // Display the List size field ChannelsSize = EditorGUILayout.IntField("Channels Registered", ChannelsSize); if (ChannelsSize != Channels.arraySize) { // Repaint the list if it changes while (ChannelsSize > Channels.arraySize) { Channels.InsertArrayElementAtIndex(Channels.arraySize); } while (ChannelsSize < Channels.arraySize) { Channels.DeleteArrayElementAtIndex(Channels.arraySize - 1); } } for (int i = 0; i < Channels.arraySize; i++) { // Display our list to the inspector window SerializedProperty MyListRef = Channels.GetArrayElementAtIndex(i); SerializedProperty channelName = MyListRef.FindPropertyRelative("channelName"); SerializedProperty channelActive = MyListRef.FindPropertyRelative("channelActive"); SerializedProperty channelTopic = MyListRef.FindPropertyRelative("channelTopic"); SerializedProperty channelModes = MyListRef.FindPropertyRelative("channelModes"); SerializedProperty channelNicklist = MyListRef.FindPropertyRelative("channelNicklist"); EditorGUILayout.Space(); GUI.color = Color.white; // Return the GUI color to default white. EditorGUILayout.PropertyField(channelName); EditorGUILayout.PropertyField(channelActive); EditorGUILayout.PropertyField(channelTopic); EditorGUILayout.PropertyField(channelModes); EditorGUILayout.PropertyField(channelNicklist); GUI.color = Color.red; // Change the GUI color for the next element. if (GUILayout.Button("Remove This Channel (" + i.ToString() + ")")) { Channels.DeleteArrayElementAtIndex(i); // Remove this index from the List } } EditorGUILayout.Space(); GUI.color = Color.green; // Change the GUI color for the next element. if (GUILayout.Button("Add new Channel")) { t.AddChannel(); } GUI.color = Color.white; // Change the GUI color for the next element. }