Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Improve your project's performance with our new guide on profiling in Unity.
    Dismiss Notice

Resolved UnityEngine.XR.WSA.WorldManager is obsolete. What is the alternative?

Discussion in 'XR Interaction Toolkit and Input' started by unity_8R3gaxreN6dMTA, Feb 22, 2021.

  1. unity_8R3gaxreN6dMTA

    unity_8R3gaxreN6dMTA

    Joined:
    Apr 9, 2018
    Posts:
    9
    UnityEngine.XR.WSA.WorldManager.GetNativeISpatialCoordinateSystemPtr() is obsolete.

    What is the up to date alternative for this

    or where does WorldManager reside now?
     
  2. unity_8R3gaxreN6dMTA

    unity_8R3gaxreN6dMTA

    Joined:
    Apr 9, 2018
    Posts:
    9
    From a Microsoft dev on stack overflow:

    Support for built-in XR is removed in the latest Unity version. The WinRT API, such as Windows.Perception.Spatial.SpatialLocator is the alternative for it. For your case, you can use var spatialCoordinateSystem = SpatialLocator.GetDefault().CreateStationaryFrameOfReferenceAtCurrentLocation().CoordinateSystem; to create a coordinate system with the origin placed at the device's position as the app is launched.
     
  3. col000r

    col000r

    Joined:
    Mar 27, 2008
    Posts:
    692
    That's great, thanks! But how do I work with files that require the Windows namespace - it all just shows up as red in Rider or VS? How do you teach them what's going on in that namespace?
     
  4. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    957
    Wrap it in
    ```
    #if ENABLE_WINMD_SUPPORT // Necessary since the Windows Types are only valid through WinMD projection.
    ...
    #end```
     
unityunity