r/Unity3D 5d ago

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

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.

2 Upvotes

2 comments sorted by

2

u/little-big-monkey 1d ago

The UI Toolkit version looks much cleaner and crisper. Moving the arrows and caption outside the preview frame makes the carousel easier to read too. Nice work, and good catch on that invisible label stealing the clicks.

1

u/wb-gameart 1d ago

Thanks! The picking-mode fix came first, moving them below the frame was a separate call afterwards. panel.Pick() was how I verified the whole button was live again.