Skip to content

Availability Filtering

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

Availability Filtering

Control whether searches consider inactive or off-screen GameObjects, and how to filter on interactability.

Default Behavior

By default a search only returns GameObjects that are:

  • Active — activeInHierarchy is true.
  • On screen — the object has non-empty screen bounds that overlap the screen. Bounds come from a RectTransform, else an enabled Renderer, else an enabled Collider; objects with none of these (empty parents, managers, cameras) have no bounds and are skipped.

Interactability is not filtered: a Button with interactable = false still matches, so there is no opt-in for non-interactable elements. Use Interactable() to require interactable ones, or With<Selectable>(s => !s.interactable) to find only disabled ones.

Including Inactive GameObjects

IncludeInactive() also searches objects that are SetActive(false) (or under an inactive parent):

// Find a hidden panel
var panel = await Find<RectTransform>(Name("HiddenPanel").IncludeInactive());
Assert.IsFalse(panel.gameObject.activeInHierarchy);

Including Off-Screen GameObjects

IncludeOffScreen() drops the on-screen requirement. Use it for objects outside the camera view, scrolled out of the screen, or with no visual bounds at all:

// A manager object with no Renderer / RectTransform
var manager = await Find<Transform>(Name("GameManager").IncludeOffScreen());

// 3D object that may be behind the camera
var crate = await Find<Rigidbody>(Name("Crate_07").IncludeOffScreen());

Interactable Elements

Interactable() keeps only objects with a Selectable whose interactable flag is true:

await Click(Type<Button>().Interactable());

// Wait until Submit becomes clickable
await WaitFor(Name("SubmitButton").Interactable(), 5f);

It reads Selectable.interactable only — a parent CanvasGroup with interactable = false is not considered. Add a Where predicate if you need that:

await Click(
    Type<Button>().Where(go => go.GetComponent<Selectable>().IsInteractable())
);

Use Cases

Verifying a Disabled Button

// Default search already finds non-interactable buttons
var submitBtn = await Find<Button>(Name("SubmitButton"));
Assert.IsFalse(submitBtn.interactable, "Submit should be disabled");

// Fill the form, then wait for it to become interactable
await TextInput(Adjacent("Email:"), "test@example.com");
await WaitFor(Name("SubmitButton").Interactable(), 5f);

Probing Without Failing

Find<T> fails the test when nothing matches unless you pass throwIfMissing: false, in which case it returns null:

var optional = await Find<Button>(Name("PromoButton"), throwIfMissing: false, seconds: 2f);
if (optional != null && !optional.interactable)
{
    Debug.Log("Promo button exists but is disabled");
}

Waiting for an Element to Become Active

// It exists (even if inactive)...
await Find<Transform>(Name("ResultPanel").IncludeInactive());

// ...then wait up to 10 s for it to become active
await WaitFor(Name("ResultPanel"), 10f);

Related Pages

Clone this wiki locally