Failed to track anchor, but unsure why

  • ARDK version: 3.0 (beta 4)
  • Unity version: 2021.3.27

Description of the issue:
I’m trying to implement ARLocations into my project, this works fine in editor but when trying to build and run it i get an immediate error saying: Failed to track anchor. Without any further info as to why it would fail here.

As a reference here is the script i’m trying out:

private void CheckForStateChanged(PlayerState state)
        {
            if (state == PlayerState.Localizing)
            {
                // if vps is already tracking some other location then stop tracking it
                if (_vpsModel.IsTracking)
                {
                    _vpsModel.ARLocationManager.StopTracking();
                    _vpsModel.IsTracking = false;
                }
                
                // find out which location we want to start tracking based on the stored payload data associated with it
                var targetPayload = _waypointModel.SelectedWaypoint.payloadId;
                var locationPrefab = _vpsModel.Locations.Single(item => item.Payload.ToBase64() == targetPayload);
                // create an instance since the transform will be changed (which is not allowed in a prefab)
                _vpsModel.InstancedLocation = Instantiate(locationPrefab);
                // set ar locations to only this new location
                _vpsModel.ARLocationManager.SetARLocations(_vpsModel.InstancedLocation);
                // and start tracking, here i get an immediate failure message without further details
                _vpsModel.ARLocationManager.StartTracking();
                _vpsModel.IsTracking = true;
            }
            else if (state != PlayerState.Localized)
            {
                if (_vpsModel.IsTracking)
                {
                    _vpsModel.ARLocationManager.StopTracking();
                    _vpsModel.IsTracking = false;
                    gameObject.Destroy(_vpsModel.InstancedLocation);
                }
            }

If anyone has experience with this or sees what’s wrong in my code please let me know. Also an example scene for this feature would probably help developers to get to grips with it a bit faster.

After looking into this a bit more i found the issue:
The persistent anchors toggle wasn’t enabled

It seems obvious now but as a tip i’d add this step to the tutorials/how-to’s on the ARDK 3.0 documentation.

Hello Merijn,

Thank you for your feedback!
I have passed along your suggestion to the team to update the documentation to prevent any future issues with the Persistent Anchors setting. Thank you for pointing that out!

As a note, we have removed your screenshot to keep your API key private.

This topic was automatically closed 2 hours after the last reply. New replies are no longer allowed.