Logo vun Unity Xr

Unity Xr

Organisatioun
Nice-Wolf-Studio
unity-xr

Unity 6 XR development guide. Use when building VR, AR, or MR experiences. Covers XR Interaction Toolkit, XR Plug-in Management, OpenXR, hand tracking, controllers, haptics, AR Foundation (plane detection, anchors, image tracking), and platform-specific setup (Meta Quest, Apple Vision Pro). Based on Unity 6.3 LTS documentation.

Iwwersiicht

EditeurNice-Wolf-Studio
Repositoryunity-claude-skills
Skill-Nummunity-xr
Stären
40
Forks
5
Matgeliwwert Fichieren
1
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 1 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum Nice-Wolf-Studio op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Unity Xr an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/Nice-Wolf-Studio/unity-claude-skills/tree/main/skills/unity-xr
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Nice-Wolf-Studio/unity-claude-skills.git /tmp/unity-claude-skills
mkdir -p .claude/skills
cp -r /tmp/unity-claude-skills/skills/unity-xr .claude/skills/unity-xr
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Unity Xr an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Unity Xr automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Unity Xr net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Unity 6 XR Development Guide

Source: Unity 6.3 LTS Documentation (6000.3)

XR Architecture Overview

Unity defines XR as encompassing three application types:

  • Virtual Reality (VR) -- The application simulates a self-contained environment around the user
  • Mixed Reality (MR) -- Combines virtual environments with real-world settings for interaction
  • Augmented Reality (AR) -- The application layers content over a view of the real world

The XR stack in Unity 6 consists of:

  1. XR Plug-in Management -- Discovers and loads platform XR SDKs
  2. OpenXR Plugin -- Open, royalty-free standard by Khronos for cross-platform XR
  3. XR Interaction Toolkit (XRI) -- High-level component-based interaction system
  4. AR Foundation -- Cross-platform AR framework with provider plug-in architecture
  5. Input System -- Action-based input required by OpenXR and XRI

XR Plug-in Management

Configure via Edit > Project Settings > XR Plug-in Management.

  • Enable OpenXR and desired Feature Groups per platform
  • Select Interaction Profiles (controller mappings) in the OpenXR > Features tab
  • Run Project Validation for build-time compatibility checks
  • Verify the active runtime matches target hardware

Supported Runtimes and Platforms

RuntimeTargetGraphics
Windows Mixed RealityWin64DX11
Oculus PC + LinkWin64DX11
Meta QuestAndroid arm64Vulkan
Magic Leap 2Android x64Vulkan
SteamVRWin64DX11

OpenXR Interaction Profiles

  • Eye Gaze Interaction
  • HTC Vive Controller
  • Khronos Simple Controller
  • Microsoft Motion Controller
  • Oculus Touch Controller
  • Valve Index Controller

OpenXR Scripting API

csharp
// Iterate all OpenXR features
var features = OpenXRSettings.Instance.GetFeatures();
foreach (var feature in features)
{
    Debug.Log($"Feature: {feature.name}, Enabled: {feature.enabled}");
}

// Get a specific feature by type
var feature = OpenXRSettings.Instance.GetFeature<MockRuntime>();
if (feature != null)
{
    Debug.Log($"MockRuntime Enabled: {feature.enabled}");
}

// Iterate feature groups (Editor only)
var featureSets = OpenXRFeatureSetManager.FeatureSetsForBuildTarget(
    BuildTargetGroup.Standalone
);
foreach (var featureSet in featureSets)
{
    Debug.Log($"Feature Set ID: {featureSet.featureSetId}");
}

XR Interaction Toolkit

Package: com.unity.xr.interaction.toolkit (v3.3.1 for Unity 6000.3)

A high-level, component-based interaction system for VR and AR. Three foundational elements:

  1. Interactors -- Handle user input and initiate interactions
  2. Interactables -- Define objects users can interact with
  3. Interaction Manager -- Coordinates between interactors and interactables

Interaction States

StateDescription
HoverInteractable is a valid target; indicates intention
SelectUser input (button/trigger) triggers active interaction (grab)
FocusPersists after selection until another interactable is selected
ActivateSecondary contextual action mapped to additional controls

Update Loop

  1. Request valid target lists from Interactors
  2. Validate existing hover/focus/selection states
  3. Exit invalid states (OnSelectExiting, OnHoverExiting, OnFocusExiting)
  4. Enter new states (OnSelectEntering, OnHoverEntering, OnFocusEntering)

Interactors are always notified before Interactables for both processing and state changes.

Interactor Types

ComponentPurpose
XR Direct InteractorClose-range (touch/grab) interaction
XR Ray InteractorRay-based distance interaction
XR Poke InteractorPoking/touching interaction
Near-Far InteractorHybrid proximity/distance
XR Gaze InteractorEye-gaze based interaction
XR Socket InteractorSnap-point interaction
Climb Teleport InteractorClimbing locomotion

Interactable Types

ComponentPurpose
XR Grab InteractableObject grabbing and manipulation
XR Simple InteractableBasic interaction events
Climb InteractableClimbable surfaces
Teleportation AnchorFixed teleport destination
Teleportation AreaArea-based teleport target
Teleportation Multi-Anchor VolumeVolume with multiple anchors

XR Grab Interactable Movement Types

  • Instantaneous -- Sets Transform position/rotation every frame; lowest latency but can pass through colliders
  • Kinematic -- Updates kinematic Rigidbody during FixedUpdate; syncs physics with visuals
  • Velocity Tracking -- Sets Rigidbody velocity/angular velocity; prevents collision penetration but may lag

Interaction Strength

Interactors and Interactables report a normalized [0.0, 1.0] analog selection strength, processed after state changes.

Interaction Groups

A Group contains multiple member Interactors sorted by priority and only allows one Interactor in the Group to interact at a time. Supports nested Groups.

See skills/unity-xr/references/xr-toolkit.md for full API details.

Locomotion System

Locomotion Providers

ProviderDescription
Teleportation ProviderPoint-and-teleport movement
Snap Turn ProviderRotates user by fixed angles
Continuous Turn ProviderSmooth rotation over time
Continuous Move ProviderSmooth movement over time
Grab Move ProviderMoves user counter to controller movement
Two-Handed Grab Move ProviderDual-controller movement, rotation, scaling
Climb ProviderMovement while selecting Climb Interactables
Gravity ProviderGravitational effects with grounded state detection

Architecture

  • Locomotion Mediator -- Manages transformation requests; states: Idle, Preparing, Moving, Ended
  • XR Body Transformer -- Queues transformations applied each Update based on priority
  • XR Movable Body -- Wraps XR Origin with body-relative transformation

Transformations are applied sequentially based on ascending priority; same-priority transformations apply in queue order.

AR Foundation

Package: com.unity.xr.arfoundation (v6.3.3 for Unity 6000.3)

AR Foundation uses a two-package architecture:

  • Base Package -- Provides AR feature interfaces (non-functional alone)
  • Provider Plug-ins -- Platform-specific implementations

Supported Platforms

PlatformProvider Plug-in
AndroidGoogle ARCore XR Plug-in
iOSApple ARKit XR Plug-in
visionOSApple visionOS XR Plug-in
HoloLens 2OpenXR Plug-in
Meta QuestUnity OpenXR: Meta
Android XRUnity OpenXR: Android XR

Feature Subsystems

FeatureManager Component
Session ManagementARSession
Device TrackingARTrackedPoseDriver
CameraARCameraManager
Plane DetectionARPlaneManager
Image TrackingARTrackedImageManager
Face TrackingARFaceManager
Body TrackingARHumanBodyManager
Object TrackingARTrackedObjectManager
Point CloudsARPointCloudManager
Ray CastingARRaycastManager
AnchorsARAnchorManager
MeshingARMeshManager
Environment ProbesAREnvironmentProbeManager
OcclusionAROcclusionManager
Bounding Box DetectionARBoundingBoxManager
ParticipantsARParticipantManager

AR Gesture Interaction (XRI)

  • TouchscreenGestureInputController -- Maps screen touches to gesture events
  • ARTransformer -- Handles place, select, translate, rotate, and scale gestures
  • Screen Space input components feed into XRRayInteractor

Hand Tracking

Hand-tracking devices expose the HandTracking characteristic and CommonUsages.HandData feature:

csharp
Hand handData;
if (device.TryGetFeatureValue(CommonUsages.handData, out handData))
{
    // Get wrist bone
    Bone rootBone;
    if (handData.TryGetRootBone(out rootBone))
    {
        Vector3 wristPosition;
        rootBone.TryGetPosition(out wristPosition);
    }

    // Get finger bones (up to 21 bones per hand)
    List<Bone> fingerBones = new List<Bone>();
    if (handData.TryGetFingerBones(HandFinger.Index, fingerBones))
    {
        foreach (Bone bone in fingerBones)
        {
            Vector3 bonePosition;
            bone.TryGetPosition(out bonePosition);
        }
    }
}

Each Bone contains: position, orientation, parent/child references.

Controllers and Haptics

Input Device Access

csharp
using UnityEngine.XR;

// Get devices by role
var devices = new List<InputDevice>();
InputDevices.GetDevicesWithRole(InputDeviceRole.RightHanded, devices);

if (devices.Count > 0)
{
    var device = devices[0];

    // Read trigger button
    bool triggerPressed;
    if (device.TryGetFeatureValue(CommonUsages.triggerButton,
        out triggerPressed) && triggerPressed)
    {
        // Handle trigger press
    }

    // Read joystick axis
    Vector2 axis;
    if (device.TryGetFeatureValue(CommonUsages.primary2DAxis, out axis))
    {
        // Use axis.x, axis.y
    }
}

Common Input Usages

UsageTypeDescription
primary2DAxisVector2Thumbstick/touchpad
triggerfloatTrigger axis (0-1)
gripfloatGrip axis (0-1)
triggerButtonboolTrigger pressed
gripButtonboolGrip pressed
primaryButtonboolA/X button
secondaryButtonboolB/Y button
menuButtonboolMenu button
userPresenceboolUser wearing headset

Haptics

csharp
HapticCapabilities capabilities;
if (device.TryGetHapticCapabilities(out capabilities))
{
    if (capabilities.supportsImpulse)
    {
        uint channel = 0;
        float amplitude = 0.5f;  // 0-1
        float duration = 1.0f;   // seconds
        device.SendHapticImpulse(channel, amplitude, duration);
    }
}

Eye Tracking

csharp
Eyes eyeData;
if (device.TryGetFeatureValue(CommonUsages.eyesData, out eyeData))
{
    // Access left/right eye positions, gaze direction, blink amounts
}

Device Lifecycle

csharp
// Subscribe to connection events
InputDevices.deviceConnected += OnDeviceConnected;
InputDevices.deviceDisconnected += OnDeviceDisconnected;

// Always validate before use
if (device.isValid)
{
    // Safe to read features
}

Tracking Origin

csharp
var subsystems = new List<XRInputSubsystem>();
SubsystemManager.GetInstances<XRInputSubsystem>(subsystems);
if (subsystems.Count > 0)
{
    subsystems[0].TrySetTrackingOriginMode(TrackingOriginModeFlags.Floor);

    // Get play area boundary
    List<Vector3> boundaryPoints = new List<Vector3>();
    if (subsystems[0].TryGetBoundaryPoints(boundaryPoints))
    {
        // Points are floor-level, clockwise-ordered
    }
}

Common Patterns

Basic XR Rig Setup

  1. Add XR Origin to scene (provides camera offset and body tracking)
  2. Add XR Interaction Manager (single instance coordinates all interactions)
  3. Add Tracked Pose Driver to camera and controllers
  4. Add Interactors to controller GameObjects
  5. Add Interactables to interactive objects

Grab Object Pattern

csharp
// On the grabbable object:
// 1. Add Rigidbody
// 2. Add Collider
// 3. Add XR Grab Interactable component
// Configure Movement Type based on needs:
//   - Instantaneous: lowest latency, no physics
//   - Kinematic: physics-synced, moderate latency
//   - Velocity Tracking: full physics, potential lag

Recommended Grab Hierarchy

Grab Interactable (Rigidbody, XRGrabInteractable)
  ├── Visuals (MeshFilter, MeshRenderer)
  ├── Collider (BoxCollider, MeshCollider)
  └── Visual Feedback (Affordance providers)

XR Interaction Simulator

Use the XR Interaction Simulator component to test interactions in the Editor without physical hardware.

Anti-Patterns

  • Single Interaction Manager missing -- All Interactors and Interactables require a shared Interaction Manager. Forgetting it causes silent failures.
  • Using legacy Input Manager with OpenXR -- OpenXR requires the new Input System package. Legacy Input.GetAxis() will not work.
  • Skipping device validation -- Always check InputDevice.isValid before reading features; devices can disconnect at any time.
  • Ignoring Attach Ease In Time on sockets -- Socket interactor visual skips occur; set Attach Ease In Time to at least 0.15 to mitigate.
  • Mouse/World-space UI with XR providers -- Enabling XR Plug-in Providers breaks standard mouse and world-space UI. Use XR UI Input Module instead.
  • Not checking compute shader support -- On platforms without compute shaders, GPU-based features may fail silently. Check SystemInfo.supportsComputeShaders.
  • Teleportation without vignette -- Instant teleportation without a Tunneling Vignette Controller causes motion sickness.
  • Poke Interactor with UI Toolkit -- Known limitation; use Canvas-based UI with Tracked Device Graphic Raycaster instead.

Key API Quick Reference

ClassNamespacePurpose
XROriginUnity.XR.CoreUtilsCamera rig and tracking space
XRInteractionManagerUnityEngine.XR.Interaction.ToolkitCoordinates interactions
XRBaseInteractorUnityEngine.XR.Interaction.ToolkitBase interactor class
XRBaseInteractableUnityEngine.XR.Interaction.ToolkitBase interactable class
XRGrabInteractableUnityEngine.XR.Interaction.ToolkitGrabbable object
InputDeviceUnityEngine.XRPhysical XR device
InputDevicesUnityEngine.XRDevice discovery
CommonUsagesUnityEngine.XRStandard input feature names
OpenXRSettingsUnityEngine.XR.OpenXROpenXR configuration
ARSessionUnityEngine.XR.ARFoundationAR session management
ARPlaneManagerUnityEngine.XR.ARFoundationPlane detection
ARAnchorManagerUnityEngine.XR.ARFoundationSpatial anchors

Related Skills

  • unity-input -- Input System package, action maps, bindings
  • unity-graphics -- Rendering pipelines, shader considerations for XR

Additional Resources

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Unity Xr?

Unity 6 XR development guide. Use when building VR, AR, or MR experiences. Covers XR Interaction Toolkit, XR Plug-in Management, OpenXR, hand tracking, controllers, haptics, AR Foundation (plane detection, anchors, image tracking), and platform-specific setup (Meta Quest, Apple Vision Pro). Based on Unity 6.3 LTS documentation.

Firwat Unity Xr op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Unity Xr besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Unity Xr an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/Nice-Wolf-Studio/unity-claude-skills/tree/main/skills/unity-xr an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Unity Xr benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Unity Xr benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Unity Xr domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Unity Xr gratis?

Jo. De Skill gëtt vum Nice-Wolf-Studio ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇