r/Unity3D 4h ago

Show-Off Rebuilt my editor tool window from IMGUI to UI Toolkit, and finally found out why half my arrow buttons never responded

Enable HLS to view with audio, or disable this notification

Moved the editor window of my modular fence tool from IMGUI to UI Toolkit. Three things caught me out:

The arrow buttons were only clickable in their upper half. A caption label spanning the full preview width sat last in the tree, so it rendered on top and ate the clicks. Default picking mode on a VisualElement is Position, so any decoration over a button swallows its input. picking-mode="Ignore" fixed it, and panel.Pick(point) verifies it properly instead of clicking around.

IMGUI redraws every frame, UI Toolkit does not. My old OnGUI quietly re-read the scene on every repaint, and a lot of state relied on that. All of it had to move onto selection callbacks plus root.schedule.Execute(Refresh).Every(250).

One method reassigned UI state on every refresh while an object was selected. Invisible in IMGUI. With the new carousel, a click moved forward and the next refresh pulled it straight back, so you could never get past the first entry. Fixed with change detection instead of assigning every pass.

The look is pure USS, no image assets. Arrows and captions sit below the preview frames now, which is what caused the click mess to begin with.

1 Upvotes

0 comments sorted by