- ARDK version: 3.0 beta 4
- Unity version: 2021,3,27f1
Description of the issue:
Hey Lightship!
So i’m building a VPS project and i’d like to give players a rough idea of how close they are to localizing properly. In the debugs i was able to find the localization confidences and i’m trying to pass those to a UI element that fills up when players get closer to localizing.
Here’s my attempt, it’s not firing atm:
using Niantic.Lightship.AR.Subsystems;
using UnityEngine;
using UnityEngine.SubsystemsImplementation.Extensions;
using UnityEngine.UI;
[RequireComponent(typeof(Image))]
public class VPSConfidenceProgressBarView : MonoBehaviour
{
private ARLocationManager _locationManager;
private XRPersistentAnchorSubsystem.Provider _provider;
private Image _image;
void Start()
{
_image = GetComponent<Image>();
_locationManager = FindObjectOfType<ARLocationManager>();
if (_locationManager == null)
return;
_provider = _locationManager.subsystem.GetProvider();
}
private void Update()
{
if (_provider == null)
{
_locationManager = FindObjectOfType<ARLocationManager>();
if (_locationManager == null)
return;
_provider = _locationManager.subsystem.GetProvider();
if (_provider == null)
return;
}
var gotLocalizationStatus = _provider.GetLocalizationStatusUpdate(out var localizationStatuses);
if (gotLocalizationStatus)
{
Debug.Log("got a change!");
foreach (var status in localizationStatuses)
{
_image.fillAmount = status.LocalizationConfidence;
}
}
}
}
If anyone can see what i’m doing wrong here i’d love to hear it