docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Hand tracking

    This page supplements the XR Hands manual and only contains information about APIs where Google's Android XR runtime exhibits platform-specific behavior.

    Important

    You must ensure to configure the appropriate Permissions to use hand tracking features on Android XR.

    Permissions

    The XRHandSubsystem in Unity's XR Hands package requires an Android system permission on the Android XR runtime. Your user must grant your app the android.permission.HAND_TRACKING permission before it can receive hand tracking data.

    Note

    The hand tracking subsystem starts immediately after OpenXR is initialized. Google's Android XR runtime logs an error every frame that the hand tracking subsystem is running and the required permission has not been granted.

    Use this example code to request the required permission if it hasn't already been granted:

    const string k_Permission = "android.permission.HAND_TRACKING";
    
    #if UNITY_ANDROID
    void Start()
    {
        if (!Permission.HasUserAuthorizedPermission(k_Permission))
        {
            var callbacks = new PermissionCallbacks();
            callbacks.PermissionDenied += OnPermissionDenied;
            callbacks.PermissionGranted += OnPermissionGranted;
    
            Permission.RequestUserPermission(k_Permission, callbacks);
        }
    }
    
    void OnPermissionDenied(string permission)
    {
        // handle denied permission
    }
    
    void OnPermissionGranted(string permission)
    {
        // handle granted permission
    }
    #endif // UNITY_ANDROID
    

    For a code sample that involves multiple permissions in a single request, refer to the Permissions page.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)