A lightweight, event‑driven VR interaction system for Unity.
Built for speed, clarity, and modularity, no Update loops, no heavy physics, just clean XR interactions.
- Event‑based XR interactions (no Update loops)
- Hand, body, or combined activation modes
- Built‑in cooldown system
- Custom editor with foldouts and debug tools
- Works with Gorilla‑Tag‑style physics and similar movement systems
- Easy to extend for teleporters, UI, shops, and more
Example Script
Note
This example script is included in the Unity package.
- Download the
EasyXRpackage - Drag it into your Unity project
- Add an
XRButtonor any subclass to your scene
Add an XRButton to any object, then extend it:
Note
XRButtons can operate on objects even if they do not have colliders.
using EasyXRSystems;
public class DoorButton : XRButton
{
public override void ButtonActivationWithHand(bool isLeftHand, bool isPressed)
{
if (isPressed)
OpenDoor();
}
private void OpenDoor()
{
Debug.Log("Door opened!");
}
}Use the EasyXR namespace at the top of your script:
Warning
This namespace is required for XRButton scripts to compile and function correctly.
using EasyXRSystems;Handling both hand and body presses:
Tip
Using a shared handler method keeps your button logic consistent across hand and body presses and avoids duplicated code.
public override void ButtonActivationWithBody(bool isPressed)
=> HandlePress(isPressed, TypesofTouch.Body);
public override void ButtonActivationWithHand(bool isLeftHand, bool isPressed)
=> HandlePress(isPressed, TypesofTouch.Hand);Teleporter example:
Caution
When overriding Unity’s Start method, declare it as protected override and call base.Start(); to ensure XRButton initializes correctly.
public class EasyXRTeleporter : XRButton
{
public Transform destination;
public GameObject thisgameobject;
protected override void Start()
{
base.Start();
thisgameobject = this.gameObject;
}
public override void ButtonActivationWithHand(bool isLeftHand, bool isPressed)
{
if (isPressed)
TeleportPlayer(destination.position);
}
}- Foldout sections for clean organization
- Debug Tools that only activate in Play Mode
- Auto‑disabled UI in Edit Mode
- Helpful warnings for missing references
Can my game support EasyXR?
Yes. Any Unity project using standard C# workflows can integrate EasyXR without issue.
Does EasyXR use Update()?
No. All interactions are event‑driven for maximum performance.
Does it work with Gorilla‑Tag‑style physics?
Yes. XRButtons were designed with physics‑based VR locomotion in mind.
How much CPU usage does XRButton use up?
XRButton averaged just 0.1% CPU across ~80 buttons in profiler tests, briefly peaking at 0.3% during startup.
A lightweight, XR‑native climbing and grabbing helper designed for physics‑based VR locomotion.
Built to be modular, predictable, and easy to integrate into any XR rig.
- Uses Unity’s XR Input System (no EasyInputs required)
- Supports left and right controllers via XRNode
- Detects climbable surfaces using OverlapSphere
- Smooth, physics‑driven climbing motion
- Optional non‑rigidbody velocity mode for smoother movement
- Fully compatible with XRDirectInteractor
- Event hooks for OnGrab and OnRelease
- Works with Gorilla‑Tag‑style locomotion and similar physics systems
-
Add the Script to Your Controllers
AttachXREasyGrabto both your Left and Right controller objects. -
Assign Required References
- Player → Your player’s Rigidbody
- Hand Transform → Usually the controller transform
- Hand Interactor → Your XRDirectInteractor component
-
Configure Input
- Set XR Hand to
LeftHandorRightHand - Choose Interaction Type (
TriggerorGrip) depending on how you want players to climb
- Set XR Hand to
-
Set Up Climbable Surfaces
- Create a new layer (e.g.,
Climbable) - Assign this layer to any object you want to be climbable
- Set the script’s Climb Layer to match
- Create a new layer (e.g.,
-
Tune Grab Range
Adjust Grab Range to control how close the hand must be to grab a surface. -
Optional Settings
- UseNonRBVel → Enables smoother, non‑rigidbody velocity calculations
- OnGrab / OnRelease → Add sound effects, particles, haptics, etc.
- Create a cube
- Add a Collider
- Set its Layer to your chosen Climb Layer
- Press Play and grab it using your chosen input (trigger or grip)
That’s all you need — climbing is now active.
XR Easy Grab follows a simple, predictable flow:
-
Detect input
UsesInputDevice.TryGetFeatureValue()to read trigger or grip values. -
Check for climbable surfaces
UsesPhysics.OverlapSphereNonAlloc()to find nearby colliders on the Climb Layer. -
Create a grab point
A temporary transform is attached to the climbable object at the exact hand position. -
Apply climbing velocity
The player’s Rigidbody is moved toward the grab point each physics frame. -
Release
When the input is released, the grab point is removed and the collider is re‑enabled.
This keeps the system fast, predictable, and easy to extend.
Does XR Easy Grab require colliders on the hands?
No. Only climbable objects need colliders.
Does it conflict with XRDirectInteractor?
No. If the hand is holding an interactable, climbing is automatically disabled.
Can I add haptics?
Yes — use the OnGrab and OnRelease events.
Does it work with Gorilla‑Tag‑style movement?
Yes. The velocity‑based movement is designed for physics locomotion.