microsoft / MixedReality-WorldLockingTools-Unity

Unity tools to provide a stable coordinate system anchored to the physical world.
https://microsoft.github.io/MixedReality-WorldLockingTools-Unity/README.html
MIT License
188 stars 45 forks source link

SpacePin NullReferenceException OnDestroy #204

Closed Waffle1434 closed 3 years ago

Waffle1434 commented 3 years ago

Description

OnDestroy (closing the SpacePin sample scene), this error occurs for every space pin ("CyanSphere", "YellowSphere", ...):

NullReferenceException: Object reference not set to an instance of an object
Microsoft.MixedReality.WorldLocking.Core.SpacePin.OnDestroy () (at Assets/WLT/WorldLocking.Core/Scripts/SpacePin.cs:222)
Microsoft.MixedReality.WorldLocking.Examples.SpacePinManipulation.OnDestroy () (at Assets/WLT/Samples/1.4.0/WLT Examples/Scripts/SpacePinManipulation.cs:69)

SpacePin.cs at this version:

protected virtual void OnDestroy()
{
    AlignmentManager.UnregisterForLoad(RestoreOnLoad);// line 222, AlignmentManager is null
}

As well as:

NullReferenceException: Object reference not set to an instance of an object
Microsoft.MixedReality.WorldLocking.Examples.SpacePinManipulation.OnDestroy () (at Assets/WLT/Samples/1.4.0/WLT Examples/Scripts/SpacePinManipulation.cs:70)

SpacePinManipulation.cs:

protected override void OnDestroy()
{
    base.OnDestroy();
    pinManipulator.Shutdown();// line 70, pinManipulator is null
}

Platform

fast-slow-still commented 3 years ago

Hi Waffle, thanks for filing this. Unfortunately, I'm unable to repro this using the latest v1.5.0.

If you are still seeing this with the latest version, please reopen the issue. That would mean there is something you are doing that I am not, or vice versa, and I'll need to get more info on repro steps. But before spending our time drilling into that, it would be best to make sure it hasn't already been accidentally fixed as part of another refactor.

Thanks!

Waffle1434 commented 2 years ago

I am still getting this error when running SpacePin.unity. I just updated to MRTK 2.7.3, WLT 1.5.8 (HoloLens 2, Unity 2019.4.35f1).

NullReferenceException: Object reference not set to an instance of an object
Microsoft.MixedReality.WorldLocking.Core.SpacePin.OnDestroy () (at Assets/WLT/WorldLocking.Core/Scripts/SpacePin.cs:272)
Microsoft.MixedReality.WorldLocking.Examples.SpacePinManipulation.OnDestroy () (at Assets/WLT/Samples/1.4.0/WLT Examples/Scripts/SpacePinManipulation.cs:69)

I've been downloading https://github.com/microsoft/MixedReality-WorldLockingTools-Unity/releases/download/v1.5.8/Microsoft.WorldLockingTools.Unity.Examples_wMRTKv2.7.2.unitypackage. The Vehicle.unity scene is present, so it would appear the examples are up to date.