From 8091db33366b294b4ac0bae137d54eac4d2b1c4d Mon Sep 17 00:00:00 2001 From: hatayama Date: Tue, 13 Oct 2026 20:21:57 +0900 Subject: [PATCH 01/10] feat: tag annotated elements with the UI system they came from Annotated screenshots are about to list UI Toolkit controls next to uGUI ones, and a caller needs to tell them apart because only uGUI paths can be fed back to simulate-mouse-ui --target-path. Add a UiSystem field to UIElementInfo and set it to "UGUI" for every uGUI element; PhysicsCollider elements leave it empty. The value strings live in the Screenshot assembly rather than in ToolContracts, which only holds the contract shape. --- .../Editor/UIElementAnnotatorCollectTests.cs | 20 +++++++++++++++++++ .../Screenshot/AnnotatedUiSystem.cs | 12 +++++++++++ .../Screenshot/AnnotatedUiSystem.cs.meta | 11 ++++++++++ .../Screenshot/UIElementAnnotator.cs | 1 + .../src/Editor/ToolContracts/UIElementInfo.cs | 1 + 5 files changed, 45 insertions(+) create mode 100644 Packages/src/Editor/FirstPartyTools/Screenshot/AnnotatedUiSystem.cs create mode 100644 Packages/src/Editor/FirstPartyTools/Screenshot/AnnotatedUiSystem.cs.meta diff --git a/Assets/Tests/Editor/UIElementAnnotatorCollectTests.cs b/Assets/Tests/Editor/UIElementAnnotatorCollectTests.cs index be0e642510..f4d507d6e5 100644 --- a/Assets/Tests/Editor/UIElementAnnotatorCollectTests.cs +++ b/Assets/Tests/Editor/UIElementAnnotatorCollectTests.cs @@ -89,6 +89,26 @@ public void CollectInteractiveElements_WithEventHandlerScripts_ClassifiesThem() Assert.That(typesByPath[root + "PointerDown"], Is.EqualTo("Button")); } + /// + /// Verifies uGUI elements, both selectables and handler scripts, are tagged as coming from uGUI. + /// + [Test] + public void CollectInteractiveElements_WithUguiElements_TagsThemAsUgui() + { + Assume.That(EventSystem.current, Is.Null); + Transform canvas = CreateCanvas("UiSystem", RenderMode.ScreenSpaceOverlay, true, null); + CreateUiChild