Arcore-unity-sdk: ARCoreSession NullReferenceException

Created on 18 Feb 2019  路  6Comments  路  Source: google-ar/arcore-unity-sdk

SPECIFIC ISSUE ENCOUNTERED

ARCoreSession raises NullReferenceException on termination of application
It also occurs in HelloAR.

log:

NullReferenceException: Object reference not set to an instance of an object
GoogleARCoreInternal.ARCoreAndroidLifecycleManager.ResetSession () (at Assets/GoogleARCore/SDK/Scripts/Managers/ARCoreAndroidLifecycleManager.cs:143)
GoogleARCore.ARCoreSession.OnDestroy () (at Assets/GoogleARCore/SDK/Scripts/ARCoreSession.cs:82)### VERSIONS USED
ARCore-unity-sdk 1.7

Unity 2018.3.5,2018.3.6
(use instant preview)

STEPS TO REPRODUCE THE ISSUE

1.open helloAR scene.
2.Play
3.Stop

WORKAROUNDS (IF ANY)

null check

ARCoreAndroidLifecycleManager.cs Line141

public void ResetSession()
{
if (OnSessionSetEnabled != null)
{
OnSessionSetEnabled(false);
_Initialize();
ExternApi.ArPresto_reset();
}
}

However, I feel that this method has not ended normally..

ADDITIONAL COMMENTS

Most helpful comment

Also have this issue. However, it currently doesn't seem to be affecting anything. Running HelloAR with Instant Preview on a USB-connected Pixel 2 XL.

The source can be changed from

        public void ResetSession()
        {
            OnSessionSetEnabled(false);
            _Initialize();
            ExternApi.ArPresto_reset();
        }

to

        public void ResetSession()
        {
            if (OnSessionSetEnabled != null)
            {
                OnSessionSetEnabled(false);
            }
            _Initialize();
            ExternApi.ArPresto_reset();
        }

since it seems like the rest of the file does a similar thing, without handling

OnSessionSetEnabled == null

All 6 comments

Experiencing the same issue. Same steps to reproduce. Using unity 2018.2.1.f1

Here the same with ARCore 1.7.0.
In 1.6.0 LifecycleManager.Instance.ResetSession(); was working just fine.
Now it's not working anymore and after Reset the Background renderer freezes and no tracking.

any update? I also met as same issue using unity 2018.3.f2

Help!!!

Also have this issue. However, it currently doesn't seem to be affecting anything. Running HelloAR with Instant Preview on a USB-connected Pixel 2 XL.

The source can be changed from

        public void ResetSession()
        {
            OnSessionSetEnabled(false);
            _Initialize();
            ExternApi.ArPresto_reset();
        }

to

        public void ResetSession()
        {
            if (OnSessionSetEnabled != null)
            {
                OnSessionSetEnabled(false);
            }
            _Initialize();
            ExternApi.ArPresto_reset();
        }

since it seems like the rest of the file does a similar thing, without handling

OnSessionSetEnabled == null

Also have this issue. However, it currently doesn't seem to be affecting anything. Running HelloAR with Instant Preview on a USB-connected Pixel 2 XL.

The source can be changed from

        public void ResetSession()
        {
            OnSessionSetEnabled(false);
            _Initialize();
            ExternApi.ArPresto_reset();
        }

to

        public void ResetSession()
        {
            if (OnSessionSetEnabled != null)
            {
                OnSessionSetEnabled(false);
            }
            _Initialize();
            ExternApi.ArPresto_reset();
        }

since it seems like the rest of the file does a similar thing, without handling

OnSessionSetEnabled == null

Also have this issue. However, it currently doesn't seem to be affecting anything. Running HelloAR with Instant Preview on a USB-connected Pixel 2 XL.

The source can be changed from

        public void ResetSession()
        {
            OnSessionSetEnabled(false);
            _Initialize();
            ExternApi.ArPresto_reset();
        }

to

        public void ResetSession()
        {
            if (OnSessionSetEnabled != null)
            {
                OnSessionSetEnabled(false);
            }
            _Initialize();
            ExternApi.ArPresto_reset();
        }

since it seems like the rest of the file does a similar thing, without handling

OnSessionSetEnabled == null

This solves the issue seems like they forgot to check for null! Thanks

Was this page helpful?
0 / 5 - 0 ratings