private void ListLoading() { var index = 0; var toggleListProperty = serializedObject.FindProperty("toggleList"); // get the toggle list _bot.ClearList(); Debug.Log("loading the list"); foreach (var action in _bot.reflectionActions) { if (index < _bot.toggleList.Count) { // begin a horizontal allignment GUILayout.BeginHorizontal(); // se the value of the toggle if (index >= toggleListProperty.arraySize) { return; } var toggleIndex = toggleListProperty.GetArrayElementAtIndex(index); toggleIndex.boolValue = EditorGUILayout.Toggle(toggleIndex.boolValue, GUILayout.Width(16)); var item = _bot.toggleList[index]; index++; /// increase the index GUILayout.Space(10); // ad some space var name = action.name; // get the name of the action if (item) { // draw the expandable action _bot.AddAction(action); #if UNITY_EDITOR if (!EditorApplication.isPlaying) { Debug.Log("serializing : " + action.name); } #endif Debug.Assert(serializedObject.FindProperty(name) != null); EditorGUILayout.PropertyField(serializedObject.FindProperty(name), GUILayout.MinWidth(100)); } else { // draw a label _bot.RemoveAction(action); #if UNITY_EDITOR if (!EditorApplication.isPlaying) { Debug.Log(name); } #endif var actualName = char.ToUpper(name[0]) + name.Substring(1); EditorGUILayout.LabelField(actualName); } GUILayout.EndHorizontal(); } } serializedObject.ApplyModifiedProperties(); }