Skip to content

Search.Path

ODD Games edited this page Oct 14, 2026 · 3 revisions

Search.Path

Find GameObjects by their full hierarchy path.

Syntax

// Shortcut (using static ODDGames.BugpunchSdk.ActionExecutor)
Path(string pattern)

// Chainable method on any Search
new Search().Path(string pattern)

Parameters

Parameter Type Description
pattern string Hierarchy path pattern (supports * wildcards and `

Path Format

Each object's path is built from the scene root down, with a leading /:

Scene Hierarchy:
Canvas
├── MainMenu
│   ├── Title
│   └── Buttons
│       ├── PlayButton
│       └── SettingsButton
└── SettingsPanel
    └── Title

Paths:
/Canvas/MainMenu/Title
/Canvas/MainMenu/Buttons/PlayButton
/Canvas/SettingsPanel/Title

The pattern is matched against the whole path. * matches any run of characters — including /, so it can span several levels. In practice, start patterns with / (exact from the root) or * (anchor anywhere).

Pattern Matches
/Canvas/MainMenu/Title Only MainMenu's Title
*/PlayButton Any object named PlayButton
*/MainMenu/* Every descendant of MainMenu, at any depth
*/Buttons/*Button Children (or deeper) of Buttons whose name ends in Button
Canvas/MainMenu/Title Nothing — missing the leading /

Examples

// Exact path from the root
await Click(Path("/Canvas/MainMenu/Buttons/PlayButton"));

// Anchored on the tail
var label = await Find<Text>(Path("*/HUD/ScorePanel/ScoreLabel"));

// Anything below MainMenu
await Click(Path("*/MainMenu/*").Type<Button>().First());

Disambiguating Same-Named Elements

// Two panels both contain a "Title"
await Click(Path("*/SettingsPanel/Header/Title"));
await Click(Path("*/ProfilePanel/Header/Title"));

The same can be expressed structurally with Name("Title").HasAncestor("SettingsPanel") (see Search.Hierarchy), which survives intermediate objects being added or renamed.

When to Use Path

Scenario Recommendation
Disambiguate same-named elements Path or HasAncestor
Find element by unique name Name
Find element by display text Text
Stable reference to a nested element Path

Chaining

// Path with component state
var button = await Find<Button>(
    Path("*/MainMenu/Buttons/*").With<Button>(b => b.interactable)
);

// Include inactive objects
var hidden = await Find<Transform>(Path("*/HiddenPanels/*").IncludeInactive());

// Restrict to a screen region
await Click(Path("*/Buttons/*").InRegion(ScreenRegion.Center).First());

Related Pages

Clone this wiki locally