private void UseInteractionGUI() { if (settingsManager && settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive) { if (_target.UpgradeSelf()) { UnityVersionHandler.CustomSetDirty(_target); } } EditorGUILayout.BeginVertical("Button"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Use interactions", EditorStyles.boldLabel); if (GUILayout.Button(addContent, EditorStyles.miniButtonRight, buttonWidth)) { Undo.RecordObject(_target, "Create use interaction"); _target.useButtons.Add(new Button()); _target.provideUseInteraction = true; } EditorGUILayout.EndHorizontal(); if (_target.provideUseInteraction) { if (cursorManager) { // Create a string List of the field's names (for the PopUp box) List <string> labelList = new List <string>(); int iconNumber; if (cursorManager.cursorIcons.Count > 0) { foreach (CursorIcon _icon in cursorManager.cursorIcons) { labelList.Add(_icon.id.ToString() + ": " + _icon.label); } foreach (Button useButton in _target.useButtons) { iconNumber = -1; int j = 0; foreach (CursorIcon _icon in cursorManager.cursorIcons) { // If an item has been removed, make sure selected variable is still valid if (_icon.id == useButton.iconID) { iconNumber = j; break; } j++; } if (iconNumber == -1) { // Wasn't found (item was deleted?), so revert to zero iconNumber = 0; useButton.iconID = 0; } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); iconNumber = CustomGUILayout.Popup("Cursor / icon:", iconNumber, labelList.ToArray(), "", "The cursor/icon associated with the interaction"); // Re-assign variableID based on PopUp selection useButton.iconID = cursorManager.cursorIcons[iconNumber].id; string iconLabel = cursorManager.cursorIcons[iconNumber].label; if (GUILayout.Button("", CustomStyles.IconCog)) { SideMenu("Use", _target.useButtons.Count, _target.useButtons.IndexOf(useButton)); } EditorGUILayout.EndHorizontal(); ButtonGUI(useButton, iconLabel, _target.interactionSource); GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1)); } } else { EditorGUILayout.LabelField("No cursor icons exist!"); iconNumber = -1; for (int i = 0; i < _target.useButtons.Count; i++) { _target.useButtons[i].iconID = -1; } } } else { ACDebug.LogWarning("A CursorManager is required to run the game properly - please open the Adventure Creator wizard and set one."); } } EditorGUILayout.EndVertical(); }