- 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.