> ## Documentation Index
> Fetch the complete documentation index at: https://docs-unity.molca.id/llms.txt
> Use this file to discover all available pages before exploring further.

# GrabStep

> XR grab/release completion rules for XRGrabInteractable targets.

**File:** `Assets/_MolcaSDK/_VR/Scripts/Scenario/Steps/GrabStep.cs`\
**Base:** [Step](/core/step)

## When to use

Use `Grab Step` when a VR training scenario needs this specific interaction as a step in a sequence. Configure entirely in the Inspector — no code required.

## Role

Completes when the trainee grabs and/or releases an **`XRGrabInteractable`** according to serialized rules (auto-find interactable, required interactor, hold duration, optional position checks).

## Inspector

All behavior is driven by **`SerializeField`** definitions on the component — use the Inspector as the contract for designers.

## Code

Completion paths (from `selectEntered` / `selectExited` on **`grabInteractable`**):

* **`completeOnGrab`** without **`requireHoldDuration`** — **`CompleteGrab()`** runs on grab if **`ValidateGrabPosition()`** passes.
* **`requireHoldDuration`** — **`UpdateStep`** completes once hold time ≥ **`minGrabDuration`** and **`completeOnGrab`** is true.
* **`completeOnRelease`** — completes on release if not already completed.
* **`ForceComplete()`** — bypasses position checks after setting internal completed flag.

```csharp theme={null}
// Designer-driven: assign XRGrabInteractable + toggles in Inspector.
// Runtime override example — require left hand only:
using MolcaSDK.VR.Scenario;
using UnityEngine.XR.Interaction.Toolkit.Interactors;

public class GrabSetup : UnityEngine.MonoBehaviour
{
    public GrabStep step;
    public XRBaseInteractor leftHand;

    private void OnEnable() => step.SetRequiredInteractor(leftHand);
}
```

## Troubleshooting

* **Console: no XRGrabInteractable found** — Assign **`grabInteractable`** or enable **`autoFindInteractable`** and put a **`XRGrabInteractable`** on this object or a child.
* **Grab registers but step never completes** — Check **`completeOnGrab`** vs **`completeOnRelease`**, **`requireHoldDuration`** / **`minGrabDuration`**, **interactor** filters (**`allowAnyInteractor`** / **`requiredInteractor`**), and **position** requirement (**`targetPosition`** + **`positionTolerance`**).
* **Wrong hand counts** — Set **`requireSpecificInteractor`** and assign the **`XRBaseInteractor`** for the intended controller.

## Related

* [Step (base class)](/core/step) — lifecycle and `Complete()`
* [VR player manager](/vr/vr-player-manager) — disable locomotion during precision grabs
* [VR inventory](/vr/vr-inventory-manager) — storing grabbed props

## Unity Editor

<Frame hint="GrabStep on a prop with XRGrabInteractable in same hierarchy." caption="GrabStep Inspector">
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/ptmolcateknologinusantara/images/features/vr/steps/grab-step-inspector.png" alt="GrabStep component in Unity Inspector" />
</Frame>
