# Input and Interaction: Start and Cancel an Interaction

> For the complete documentation index, see [llms.txt](llms.txt).

Let a player search a crate and stop the search by releasing Interact. Ninja Input reads the button. Ninja Interaction reserves the slot, counts the time, and reports whether the search finished. Start with a [working Input Setup](ipt-first-steps.html) and a [focused interaction target](int-first-steps.html).

## Start on Press and Let the Tree Count

Procedure: Route press and release to the current pawn

1. Set up a [tree-timed search](int-adv-interaction-duration.html). Map a Boolean IA_Interact action with no explicit triggers. Add a custom Ninja Input Handler to the active Input Setup, assign the action, and select Started and Completed.

2. In Handle Started Event, call `GetPawn` on the supplied Input Manager, then `GetInteractionManagerComponent` for that pawn. Remember the focused search summary's ID on the pawn. Call `TryInitializeInteractionWithCurrentTarget` with the offered search type, such as `Interaction.Type.Search`.

3. In Handle Completed Event, use `GetActiveInteractionSummary`. If the ID matches this press and the search is still waiting to commit, call `TryCancelCurrentInteraction` with `Interaction.Event.CancelledButtonPress`. Clear the saved ID. For a press-and-wait search, let the tree finish after release.

In a C++ input handler, the corresponding overrides are `HandleStartedEvent_Implementation` and `HandleCompletedEvent_Implementation`. Keep the selection on the player or pawn so two players using the same handler have independent searches.

## Confirm After an Input Hold

For a switch that should stay available to others while the first player holds a button, use an immediate slot with a one-shot Hold trigger. On Started, save the focused summary ID. On Triggered, take and clear that ID and call `TryInitializeInteractionBySummaryId` once. Clear it on Canceled, loss of focus, or unregistration. Blueprint can bind `OnFocusStateChanged` on the manager. C++ can subscribe to `Native_OnFocusStateChanged` and remove the binding when the prompt closes. [Confirm an Interaction with a Hold Input Action](int-guide-hold-input.html) includes the progress bar.

## Block Movement During the Interaction

For a search animation that takes control of movement or facing, grant `Input.Block.Movement` or `Input.Block.Rotation` through its Gameplay Effect during playback. The corresponding Ninja Input handlers honor those tags. [Animate an Interaction](int-adv-interaction-animations.html) covers the effect and animation setup.

## Try It in Play

Release halfway through the crate search. The reserved slot should become available and the search should yield nothing. On the input-timed switch, release early and check that the interaction never starts. Then start holding on switch A and turn toward switch B. Neither should activate until a fresh press. If B activates, check that confirmation uses the saved ID.

