ARFoundation 4.1.1 – Status Reports "Tracking" after Denying Camera Access

Hello there. This is a little redundant with a report I’m sending through the Unity Bug Reporter, but I wanted to make sure it landed in front of the ARF team and had a place for discussion.

  1. What happened

When asking for camera permission on the first run (fresh app install), if the user taps “Don’t Allow” then camera permission is not granted but ARFoundation reports both the tracking state and session state as tracking. It probably goes without saying why this is a problem.

  1. How we can reproduce it

Via the Unity Bug Reporter I attached a full project, but essentially it’s just ARF and this one script:

[SerializeField]
ARSession aRSession;

TrackingState lastTrackingState;
NotTrackingReason lastNotTrackingReason;

void Update () {
    if (aRSession.subsystem == null)
        return;

    if (aRSession.subsystem.trackingState == TrackingState.Tracking) {
        if (lastTrackingState != TrackingState.Tracking) {
            Debug.LogWarningFormat ("Tracking Started" +
                "\n• tracking state:{0}\n• session state: {1}.", aRSession.subsystem.trackingState, ARSession.state);
        }
    } else if (aRSession.subsystem.trackingState == TrackingState.Limited) {
        // Display one of our problem states if tracking just stopped or if the reason changed.
        if (lastTrackingState == TrackingState.Tracking || lastNotTrackingReason !=           aRSession.subsystem.notTrackingReason) {
           Debug.LogFormat ("Tracking Limited" +
               "\n• tracking state:{0}\n• session state: {1}.", aRSession.subsystem.trackingState, ARSession.state);
         }

    } else if (aRSession.subsystem.trackingState == TrackingState.None) {
        if (lastTrackingState != TrackingState.None) {
           Debug.LogFormat ("Not Tracking" +
                "\n• tracking state:{0}\n• session state: {1}.", aRSession.subsystem.trackingState, ARSession.state);
        }
    }
    lastTrackingState = aRSession.subsystem.trackingState;
    lastNotTrackingReason = aRSession.subsystem.notTrackingReason;
}

As soon as the ARSession object becomes active (mine starts disabled) you get the camera permission prompt. If you tap “Don’t Allow” then the above script will spit out the log about tracking having started, where one might expect session and tracking states to be “None” or something like that.

Frequency: Most of the time. (I’ve had it NOT happen once in a series of a dozen tests.)
ARFoundation 4.1.1
Unity 2020.1.11f1 (also confirmed in Unity 2019.4.16f1)
iPhone 12 Pro Max
iOS 14.2.1

Team would like you to file a bug report for us.

Like I said above, I’ve submitted a bug report already and posted it here to make sure it came to the attention of the right folks :slight_smile:

1 Like

Whoops! Looks like you did! Thank you for that, and apologies for missing that bit. :slight_smile:

1 Like

No worries. Here’s the link for anyone coming here who is curious:
https://fogbugz.unity3d.com/default.asp?1306532_he4e4jqbfa4nbso6