Window Framework for Unity UI Toolkit
Manipulators
Built-in Manipulators
- Window Dragging
- Window Resizing
- Tooltip (on hover) Displays
- Contextual Menu Activator
- Icon Dragging Experimental
- Single Click Selector Experimental
- Double Click Activator Experimental
Some manipulators are built-in and require no extra configuration. Others, such as the Context Menu, need additional setup.
Below you’ll find setup notes and options for each manipulator.
Window Dragging
The drag manipulator is part of the window header. It is enabled/disabled using AllowMove = true/false
.
Note: The window header must be visible for drag functionality. Hiding the header disables dragging.
Window Resizing
The resize manipulator appears in the lower-right of the window (footer). Enable/disable with AllowResize = true/false
.
Note: The footer must be visible to allow resizing. Hiding the footer disables resizing.
Tooltip Displays
Any UI element can show a tooltip by setting a value for its tooltip property. The ToolTip controller displays it on mouse hover.
Location parameters:
B:
below elementT:
above elementL:
left of elementR:
right of element
L:MyToolTip Text
to keep the tooltip visible.
Tooltips rely on scheduled runtime updates (1–3ms delays). If tooltips persistently display off-target, adjust these timing values for best results.
Contextual (Right Click) Menu
A context menu can be attached to any UI element and populated at creation time. It is composed of two classes:
ContextMenuConfig
ContextMenuItem
Create a context menu configuration object as follows:
var config = new ContextMenuConfig
{
Title = "Window Options", // Menu Title
Items = new List
{
new ContextMenuItem(
"Lock", // Menu Text
() => LockWindow(), // On click action
() => AllowLock && !Locked // Visible only if lockable
),
new ContextMenuItem(
"Unlock", // Menu Text
() => LockWindow(), // On click action
() => AllowLock && Locked // Visible only if locked
),
new ContextMenuItem(
"Close", // Menu Text
() => CloseWindow(), // On click action
() => AllowClose && !Locked // Visible only if closeable
)
}
};
To attach a context menu to any Visual Element use the following code at the time of creation of the element:
MyVisualElement.AddManipulator(new ContextMenuActivator(Config));
The Context Menu can be styled with your stylesheet using the selectors:
#ContextMenu
#ContextMenu > Label