Search Unity

AR Foundation build error on WebGL: SpatialTracking does not exist in the namespace UnityEngine

Discussion in 'Handheld AR' started by HEMarkTrueblood, Feb 19, 2019.

  1. HEMarkTrueblood

    HEMarkTrueblood

    Joined:
    Feb 15, 2019
    Posts:
    1
    I'm working on a multiplatform game (WebGL and mobile), that will feature an AR feature in the mobile version. But I've been having trouble building the WebGL version without completely removing the AR Foundation package and all references.

    When I open the AR Foundation example project and attempt to create a WebGL build, I get the following compiler error:

    Code (CSharp):
    1. Library\PackageCache\com.unity.xr.arfoundation@1.0.0-preview.22\Runtime\AR\ARSessionOrigin.cs(3,19): error CS0234: The type or namespace name 'SpatialTracking' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)
    As far as I can tell, Unity doesn't have any way to exclude packages on a platform-dependent basis, or I would simply exclude the entire AR package from my buildsdefinition. I don't actually need any of the AR Foundation features, I simply need it to stop throwing errors when I build for WebGL so I don't have to maintain 2 completely separate projects, or uninstall/reinstall the package every time I switch platforms.

    Is there any work-around for this, or is this going to be fixed in an upcoming version? Thanks.
     
    coder89 and Saicopate like this.
  2. coder89

    coder89

    Joined:
    Oct 26, 2018
    Posts:
    17
    I faced the exact same problem with Windows/UWP build target. There are more packages having issues with cross-platform. Unfortunately, it seems that either Package Manager or packages themselves are not production-ready yet.
     
  3. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    269
    AR Foundation is for mobile platforms Android and IOS only because they have ARKit/ARCore capabilities - there are various browser restrictions on camera access and various other problems like that causing ARFoundation to not be available for a WebGL export.
     
  4. Shirzad

    Shirzad

    Joined:
    Dec 8, 2016
    Posts:
    10
    You need too update all packages under package manager.
     
    Last edited: Apr 29, 2019
  5. cbrig25

    cbrig25

    Joined:
    Aug 18, 2015
    Posts:
    2
    For Unity 2019.1.4 when using mapbox to remove the error SpatialTracking does not exist. First go to Project settings - player and ensure in the XR settings that ARCore Supported is ticked. Then go to package manager and install XR Legacy Input Helpers.