Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Editor/GameplayTagContainerTreeView.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
using UnityEngine;
Expand Down Expand Up @@ -39,6 +40,17 @@ protected override void RowGUI(RowGUIArgs args)
GameplayTagTreeViewItem item = args.item as GameplayTagTreeViewItem;
bool added;


if (IsSelected(item.id) && Event.current.keyCode == KeyCode.Return && Event.current.type == EventType.KeyUp)
{
if (!item.IsIncluded || !item.IsExplicitIncluded)
AddTag(item.Tag);
else
RemoveTag(item.Tag);

Repaint(); // Have to repaint or the Toggle GUI is not updated accordingly
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code block listening to enter key for a gameplaytag container to add/remove the tag to the container


EditorGUI.BeginChangeCheck();
EditorGUI.showMixedValue = item.IsIncluded && !item.IsExplicitIncluded;
added = EditorGUI.Toggle(rect, s_TempContent, item.IsIncluded);
Expand Down
10 changes: 10 additions & 0 deletions Editor/GameplayTagTreeView.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
using UnityEngine;
Expand Down Expand Up @@ -69,6 +70,15 @@ protected override void RowGUI(RowGUIArgs args)

GameplayTagTreeViewItem item = args.item as GameplayTagTreeViewItem;


if (IsSelected(item.id) && Event.current.keyCode == KeyCode.Return && Event.current.type == EventType.KeyUp)
{
m_TagNameProperty.stringValue = item.Tag.Name;
m_TagNameProperty.serializedObject.ApplyModifiedProperties();

m_OnSelectionChange?.Invoke();
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code block listening to the enter key to select a gameplaytag


if (GUI.Button(rect, s_TempContent, EditorStyles.label))
{
m_TagNameProperty.stringValue = item.Tag.Name;
Expand Down
3 changes: 3 additions & 0 deletions Editor/GameplayTagTreeViewBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ public GameplayTagTreeViewBase(TreeViewState treeViewState)
rowHeight = 24;

Reload();

m_SearchField.SetFocus();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directly set the focus on the search field when opening the dropdown to be able to search directly

m_SearchField.downOrUpArrowKeyPressed += SetFocusAndEnsureSelectedItem;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Select the first treeview item on up/down arrows

}

public override void OnGUI(Rect rect)
Expand Down