agentleFS
batihandevbatihandev/unity-mcp-skills/skills/xr/SKILL.md

unity-xr

Skill7 starsChanged 7 months agoMITView on GitHub

Use when users want to set up XR rigs, add grab interactions, configure teleportation, continuous locomotion, XR UI, or diagnose XR scenes. Requires com.unity.xr.interaction.toolkit 3.x on Unity 6+.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this module for XR Interaction Toolkit setup and configuration.

    line 14
  2. Very specific:

    Do not assume physics Layer or Tag replaces InteractionLayerMask

    line 24
  3. Distinctive:

    Do not guess component property names — they are set via reflection.

    line 25
  4. Very specific:

    Create the rig with xr_setup_rig.

    line 97
  5. Very specific:

    Ensure XR UI input exists with xr_setup_event_system.

    line 98
  6. Distinctive:

    Add at least one interactor per controller.

    line 99
  7. Distinctive:

    Add a ray interactor on the controller that should click UI

    line 124
  8. Very specific:

    Use InteractionLayerMask for interactor/interactable filtering.

    line 174

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Unity XR Interaction Toolkit Skills

Requirements

  • com.unity.xr.interaction.toolkit (≥ 3.4). Recipes target XRI 3 API only. If missing, install via Unity_PackageManager_ExecuteAction with operation=Add, package=com.unity.xr.interaction.toolkit, version=3.4.1.

When to Use

Use this module for XR Interaction Toolkit setup and configuration.

Hard rule: Read this file before the first xr_* call in a session. Wrong property names can fail silently because the bridge is reflection-based.

Common Mistakes

DO NOT (common hallucinations):

  • XRHand, XRPlayer, XRTeleporter, GrabInteractor, VRController, XRLocomotion, and XRManager are not the runtime classes you want here
  • interactable.OnGrab() / OnRelease() are not the XRI event model -> use selectEntered / selectExited
  • controller.vibrate() is not the documented route here -> configure haptics through xr_configure_haptics
  • Do not assume physics Layer or Tag replaces InteractionLayerMask
  • Do not guess component property names — they are set via reflection. Use the skill parameters directly

Correct class names to anchor on:

  • XRInteractionManager
  • XROrigin
  • XRRayInteractor
  • XRDirectInteractor
  • XRSocketInteractor
  • XRGrabInteractable
  • XRSimpleInteractable
  • TeleportationProvider
  • TeleportationArea
  • TeleportationAnchor
  • ContinuousMoveProvider
  • SnapTurnProvider
  • ContinuousTurnProvider
  • TrackedDeviceGraphicRaycaster
  • XRUIInputModule
  • TrackedPoseDriver

Routing:

  • For non-XR Canvas UI creation -> use ui

Quick Reference

Setup and Diagnostics

SkillUseKey parameters
xr_check_setupValidate XR package, rig, managers, and scene prerequisitesverbose?
xr_setup_rigCreate XR Origin + camera + controllersname, cameraYOffset?
xr_setup_interaction_managerAdd or find managernone
xr_setup_event_systemReplace/add XR UI input stacknone
xr_get_scene_reportReport scene-side XR statusnone

Interactors and Interactables

SkillUseKey parameters
xr_add_ray_interactorRemote pointing / ray interactionname, maxDistance?, lineType?
xr_add_direct_interactorClose-range hand grabname, radius?
xr_add_socket_interactorSnap-to slotname, showHoverMesh?, recycleDelay?
xr_add_grab_interactableRigidbody + collider + grab configname, movementType?, throwOnDetach?
xr_add_simple_interactableHover/select without grabname
xr_configure_interactableFine-tune interactable behaviortarget + changed fields only
xr_list_interactorsList all scene interactorsnone
xr_list_interactablesList all scene interactablesnone

Locomotion and XR UI

SkillUseKey parameters
xr_setup_teleportationAdd teleport provider to XR Originnone
xr_add_teleport_areaMark a surface as teleportablename, matchOrientation?
xr_add_teleport_anchorCreate a stationary teleport destinationname, x/y/z, rotY?, matchOrientation?
xr_setup_continuous_moveAdd stick locomotionmoveSpeed?, enableStrafe?, enableFly?
xr_setup_turn_providerAdd snap or smooth turnturnType, turnAmount?, turnSpeed?
xr_setup_ui_canvasConvert Canvas for XR interactionname

Feedback and Filtering

SkillUseKey parameters
xr_configure_hapticsSet hover/select vibrationname, intensities, durations
xr_add_interaction_eventWire interaction callback to target methodname, eventType, targetName, targetMethod
xr_configure_interaction_layersSet InteractionLayerMaskname, layers, isInteractor

Workflow Summary

Rig Setup

  1. Run xr_check_setup.
  2. Create the rig with xr_setup_rig.
  3. Ensure XR UI input exists with xr_setup_event_system.
  4. Add at least one interactor per controller.

Grab Setup

  • Direct hand grab: xr_add_direct_interactor + xr_add_grab_interactable
  • Distance grab: xr_add_ray_interactor + xr_add_grab_interactable
  • Socket placement: xr_add_socket_interactor + grabbable object

movementType defaults matter:

  • VelocityTracking: best general-purpose physical grab
  • Kinematic: use for handles/tools that should not get stuck
  • Instantaneous: best for precise remote grab

Locomotion Setup

  • Teleport: xr_setup_teleportation + xr_add_ray_interactor + xr_add_teleport_area/xr_add_teleport_anchor
  • Continuous locomotion: xr_setup_continuous_move
  • Turn: xr_setup_turn_provider

Comfort default: snap turn + moderate move speed (~2.0 m/s).

XR UI

  1. Convert Canvas with xr_setup_ui_canvas
  2. Ensure xr_setup_event_system
  3. Add a ray interactor on the controller that should click UI

Events and Haptics

Event types for xr_add_interaction_event: selectEntered, selectExited, hoverEntered, hoverExited, firstSelectEntered, lastSelectExited, activated, deactivated.

Haptic defaults: selectIntensity=0.5, selectDuration=0.1, hoverIntensity=0.1, hoverDuration=0.05.

Collider Configuration Matrix

This is the most important XR anti-hallucination table.

ComponentCollider requiredisTriggerRecommended colliderReason
XRDirectInteractorYesTrueSphereCollider (0.1-0.25)Overlap detection
XRRayInteractorNo-NoneUses raycasts
XRSocketInteractorYesTrueSphereCollider (0.1-0.3)Snap zone
XRGrabInteractableYesFalseBoxCollider or convex MeshColliderPhysics + ray target
XRSimpleInteractableYesFalseBoxColliderSelection detection
TeleportationAreaYesFalseMeshCollider or BoxColliderSurface raycast target
TeleportationAnchorYesFalseThin BoxColliderPoint raycast target

Critical rules:

  1. XRGrabInteractable needs a Rigidbody.
  2. A grabbable collider must not be trigger.
  3. A direct interactor collider must be trigger.
  4. Dynamic mesh colliders must be convex.
  5. Socket colliders should be trigger-only overlap zones.

Version Compatibility

TopicXRI 2.xXRI 3.x
Main namespace styleroot namespacesplit sub-namespaces
Rig typeXROriginXROrigin
Locomotion coreLocomotionSystemLocomotionMediator
Controller typeActionBasedControllerActionBasedController
Bridge behaviorReflection helper falls back automaticallyReflection helper prefers 3.x first

C# Templates

Recipe path rule: ../../recipes/xr/<command>.md

See ../../recipes/xr/<command>.md for C# templates.

Important Notes

  1. Scenes should normally have exactly one XRInteractionManager.
  2. Most locomotion skills assume an XROrigin already exists.
  3. Package installation or reconfiguration can trigger Domain Reload. Wait before retrying XR calls.
  4. Use InteractionLayerMask for interactor/interactable filtering.
  5. For custom XR scripts, prefer XRI lifecycle hooks and events over Update() polling when possible.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.