Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

GameObject destroy errors reported in editor on the UWP platform #97

Closed
SimonDarksideJ opened this issue Sep 22, 2020 · 8 comments · Fixed by XRTK/com.xrtk.core#668
Closed
Assignees
Labels
Bug Something isn't working

Comments

@SimonDarksideJ
Copy link
Contributor

XRTK - Mixed Reality Toolkit Bug Report

Describe the bug

There seems to be an issue with the Spatial Object management where it is cleared prematurely in the editor when the scene is closed.

To Reproduce

  1. Switch to UWP platform
  2. Run XRTK in the editor
  3. Stop the editor
  4. See error

Expected behavior

No errors

Actual behavior

Your Setup

  • Operation system : Windows
  • Unity Version : 2019.1.4
  • XRTK Version 0.2.0
@StephenHodgson
Copy link
Contributor

Could you paste in the error stack trace please?

@SimonDarksideJ
Copy link
Contributor Author

No stack trace, the only error reported is:

"Can't destroy Transform component of 'Blank Spatial Mesh GameObject'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed."

Interestingly, it doesn't occur when the "Windows Mixed Reality spatial locatability state" is "Inhibited".

@StephenHodgson
Copy link
Contributor

Hmm, sounds like a race condition where the object is already cleaned up by the time we iterate over the collection to try and clean up manually. I'll check it out.

@StephenHodgson StephenHodgson self-assigned this Sep 22, 2020
@StephenHodgson StephenHodgson transferred this issue from XRTK/com.xrtk.core Sep 22, 2020
@StephenHodgson StephenHodgson added the Bug Something isn't working label Sep 22, 2020
@StephenHodgson
Copy link
Contributor

When I stared the Holographic emulation everything seemed to work fine for me.
I also didn't have a problem when the WMR Portal was running as well. This seems to only happen when we're not targeting a 3d platform. Maybe we should try to disable the spatial understanding when a compatible device isn't found.

@FejZa could you possibly troubleshoot this with your device connected to the editor?

@FejZa
Copy link
Contributor

FejZa commented Sep 22, 2020

Will do

@StephenHodgson
Copy link
Contributor

StephenHodgson commented Sep 22, 2020

One other interesting thing to note, when starting then stopping emulation then trying this again in the editor, I didn't get the errors again until after I restarted the editor.

@StephenHodgson
Copy link
Contributor

StephenHodgson commented Sep 22, 2020

Here's the list of errors I'm getting atm:

Can't destroy Transform component of 'Main Camera'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
	0x00007FF78458E2EC (Unity) StackWalker::GetCurrentCallstack
	0x00007FF7845917A1 (Unity) StackWalker::ShowCallstack
	0x00007FF782CEFA45 (Unity) GetStacktrace
	0x00007FF784FB42B0 (Unity) DebugStringToFile
	0x00007FF783FFA04F (Unity) CanDestroyObject
	0x00007FF783FFD29F (Unity) DestroyObjectHighLevel
	0x00007FF784011633 (Unity) DestroyWorldObjects
	0x00007FF7827B7254 (Unity) EditorSceneManager::RestoreSceneBackups
	0x00007FF782D280CE (Unity) PlayerLoopController::ExitPlayMode
	0x00007FF782D37E57 (Unity) PlayerLoopController::SetIsPlaying
	0x00007FF782D3AB88 (Unity) Application::TickTimer
	0x00007FF782FF8E5B (Unity) MainMessageLoop
	0x00007FF783002867 (Unity) WinMain
	0x00007FF78594C9CE (Unity) __scrt_common_main_seh
	0x00007FF859226FD4 (KERNEL32) BaseThreadInitThunk
	0x00007FF859F5CEC1 (ntdll) RtlUserThreadStart
	
Can't destroy Transform component of 'Blank Spatial Mesh GameObject'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
	0x00007FF78458E2EC (Unity) StackWalker::GetCurrentCallstack
	0x00007FF7845917A1 (Unity) StackWalker::ShowCallstack
	0x00007FF782CEFA45 (Unity) GetStacktrace
	0x00007FF784FB42B0 (Unity) DebugStringToFile
	0x00007FF783FFA04F (Unity) CanDestroyObject
	0x00007FF783FFD29F (Unity) DestroyObjectHighLevel
	0x00007FF784011633 (Unity) DestroyWorldObjects
	0x00007FF7827B7254 (Unity) EditorSceneManager::RestoreSceneBackups
	0x00007FF782D280CE (Unity) PlayerLoopController::ExitPlayMode
	0x00007FF782D37E57 (Unity) PlayerLoopController::SetIsPlaying
	0x00007FF782D3AB88 (Unity) Application::TickTimer
	0x00007FF782FF8E5B (Unity) MainMessageLoop
	0x00007FF783002867 (Unity) WinMain
	0x00007FF78594C9CE (Unity) __scrt_common_main_seh
	0x00007FF859226FD4 (KERNEL32) BaseThreadInitThunk
	0x00007FF859F5CEC1 (ntdll) RtlUserThreadStart
	
Can't destroy Transform component of 'UIRaycastCamera'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
	0x00007FF78458E2EC (Unity) StackWalker::GetCurrentCallstack
	0x00007FF7845917A1 (Unity) StackWalker::ShowCallstack
	0x00007FF782CEFA45 (Unity) GetStacktrace
	0x00007FF784FB42B0 (Unity) DebugStringToFile
	0x00007FF783FFA04F (Unity) CanDestroyObject
	0x00007FF783FFD29F (Unity) DestroyObjectHighLevel
	0x00007FF784011633 (Unity) DestroyWorldObjects
	0x00007FF7827B7254 (Unity) EditorSceneManager::RestoreSceneBackups
	0x00007FF782D280CE (Unity) PlayerLoopController::ExitPlayMode
	0x00007FF782D37E57 (Unity) PlayerLoopController::SetIsPlaying
	0x00007FF782D3AB88 (Unity) Application::TickTimer
	0x00007FF782FF8E5B (Unity) MainMessageLoop
	0x00007FF783002867 (Unity) WinMain
	0x00007FF78594C9CE (Unity) __scrt_common_main_seh
	0x00007FF859226FD4 (KERNEL32) BaseThreadInitThunk
	0x00007FF859F5CEC1 (ntdll) RtlUserThreadStart
	
Can't destroy Transform component of 'Blank Spatial Mesh GameObject'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
	0x00007FF78458E2EC (Unity) StackWalker::GetCurrentCallstack
	0x00007FF7845917A1 (Unity) StackWalker::ShowCallstack
	0x00007FF782CEFA45 (Unity) GetStacktrace
	0x00007FF784FB42B0 (Unity) DebugStringToFile
	0x00007FF783FFA04F (Unity) CanDestroyObject
	0x00007FF783FFD29F (Unity) DestroyObjectHighLevel
	0x00007FF784011633 (Unity) DestroyWorldObjects
	0x00007FF7827B7254 (Unity) EditorSceneManager::RestoreSceneBackups
	0x00007FF782D280CE (Unity) PlayerLoopController::ExitPlayMode
	0x00007FF782D37E57 (Unity) PlayerLoopController::SetIsPlaying
	0x00007FF782D3AB88 (Unity) Application::TickTimer
	0x00007FF782FF8E5B (Unity) MainMessageLoop
	0x00007FF783002867 (Unity) WinMain
	0x00007FF78594C9CE (Unity) __scrt_common_main_seh
	0x00007FF859226FD4 (KERNEL32) BaseThreadInitThunk
	0x00007FF859F5CEC1 (ntdll) RtlUserThreadStart
	
Can't destroy Transform component of 'Blank Spatial Mesh GameObject'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
	0x00007FF78458E2EC (Unity) StackWalker::GetCurrentCallstack
	0x00007FF7845917A1 (Unity) StackWalker::ShowCallstack
	0x00007FF782CEFA45 (Unity) GetStacktrace
	0x00007FF784FB42B0 (Unity) DebugStringToFile
	0x00007FF783FFA04F (Unity) CanDestroyObject
	0x00007FF783FFD29F (Unity) DestroyObjectHighLevel
	0x00007FF784011633 (Unity) DestroyWorldObjects
	0x00007FF7827B7254 (Unity) EditorSceneManager::RestoreSceneBackups
	0x00007FF782D280CE (Unity) PlayerLoopController::ExitPlayMode
	0x00007FF782D37E57 (Unity) PlayerLoopController::SetIsPlaying
	0x00007FF782D3AB88 (Unity) Application::TickTimer
	0x00007FF782FF8E5B (Unity) MainMessageLoop
	0x00007FF783002867 (Unity) WinMain
	0x00007FF78594C9CE (Unity) __scrt_common_main_seh
	0x00007FF859226FD4 (KERNEL32) BaseThreadInitThunk
	0x00007FF859F5CEC1 (ntdll) RtlUserThreadStart
	
Can't destroy Transform component of 'Blank Spatial Mesh GameObject'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
	0x00007FF78458E2EC (Unity) StackWalker::GetCurrentCallstack
	0x00007FF7845917A1 (Unity) StackWalker::ShowCallstack
	0x00007FF782CEFA45 (Unity) GetStacktrace
	0x00007FF784FB42B0 (Unity) DebugStringToFile
	0x00007FF783FFA04F (Unity) CanDestroyObject
	0x00007FF783FFD29F (Unity) DestroyObjectHighLevel
	0x00007FF784011633 (Unity) DestroyWorldObjects
	0x00007FF7827B7254 (Unity) EditorSceneManager::RestoreSceneBackups
	0x00007FF782D280CE (Unity) PlayerLoopController::ExitPlayMode
	0x00007FF782D37E57 (Unity) PlayerLoopController::SetIsPlaying
	0x00007FF782D3AB88 (Unity) Application::TickTimer
	0x00007FF782FF8E5B (Unity) MainMessageLoop
	0x00007FF783002867 (Unity) WinMain
	0x00007FF78594C9CE (Unity) __scrt_common_main_seh
	0x00007FF859226FD4 (KERNEL32) BaseThreadInitThunk
	0x00007FF859F5CEC1 (ntdll) RtlUserThreadStart
	
Can't destroy Transform component of 'Meshes'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
	0x00007FF78458E2EC (Unity) StackWalker::GetCurrentCallstack
	0x00007FF7845917A1 (Unity) StackWalker::ShowCallstack
	0x00007FF782CEFA45 (Unity) GetStacktrace
	0x00007FF784FB42B0 (Unity) DebugStringToFile
	0x00007FF783FFA04F (Unity) CanDestroyObject
	0x00007FF783FFD29F (Unity) DestroyObjectHighLevel
	0x00007FF784011633 (Unity) DestroyWorldObjects
	0x00007FF7827B7254 (Unity) EditorSceneManager::RestoreSceneBackups
	0x00007FF782D280CE (Unity) PlayerLoopController::ExitPlayMode
	0x00007FF782D37E57 (Unity) PlayerLoopController::SetIsPlaying
	0x00007FF782D3AB88 (Unity) Application::TickTimer
	0x00007FF782FF8E5B (Unity) MainMessageLoop
	0x00007FF783002867 (Unity) WinMain
	0x00007FF78594C9CE (Unity) __scrt_common_main_seh
	0x00007FF859226FD4 (KERNEL32) BaseThreadInitThunk
	0x00007FF859F5CEC1 (ntdll) RtlUserThreadStart
	
Can't destroy Transform component of 'Blank Spatial Mesh GameObject'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
	0x00007FF78458E2EC (Unity) StackWalker::GetCurrentCallstack
	0x00007FF7845917A1 (Unity) StackWalker::ShowCallstack
	0x00007FF782CEFA45 (Unity) GetStacktrace
	0x00007FF784FB42B0 (Unity) DebugStringToFile
	0x00007FF783FFA04F (Unity) CanDestroyObject
	0x00007FF783FFD29F (Unity) DestroyObjectHighLevel
	0x00007FF784011633 (Unity) DestroyWorldObjects
	0x00007FF7827B7254 (Unity) EditorSceneManager::RestoreSceneBackups
	0x00007FF782D280CE (Unity) PlayerLoopController::ExitPlayMode
	0x00007FF782D37E57 (Unity) PlayerLoopController::SetIsPlaying
	0x00007FF782D3AB88 (Unity) Application::TickTimer
	0x00007FF782FF8E5B (Unity) MainMessageLoop
	0x00007FF783002867 (Unity) WinMain
	0x00007FF78594C9CE (Unity) __scrt_common_main_seh
	0x00007FF859226FD4 (KERNEL32) BaseThreadInitThunk
	0x00007FF859F5CEC1 (ntdll) RtlUserThreadStart
	
Can't destroy Transform component of 'Blank Spatial Mesh GameObject'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
	0x00007FF78458E2EC (Unity) StackWalker::GetCurrentCallstack
	0x00007FF7845917A1 (Unity) StackWalker::ShowCallstack
	0x00007FF782CEFA45 (Unity) GetStacktrace
	0x00007FF784FB42B0 (Unity) DebugStringToFile
	0x00007FF783FFA04F (Unity) CanDestroyObject
	0x00007FF783FFD29F (Unity) DestroyObjectHighLevel
	0x00007FF784011633 (Unity) DestroyWorldObjects
	0x00007FF7827B7254 (Unity) EditorSceneManager::RestoreSceneBackups
	0x00007FF782D280CE (Unity) PlayerLoopController::ExitPlayMode
	0x00007FF782D37E57 (Unity) PlayerLoopController::SetIsPlaying
	0x00007FF782D3AB88 (Unity) Application::TickTimer
	0x00007FF782FF8E5B (Unity) MainMessageLoop
	0x00007FF783002867 (Unity) WinMain
	0x00007FF78594C9CE (Unity) __scrt_common_main_seh
	0x00007FF859226FD4 (KERNEL32) BaseThreadInitThunk
	0x00007FF859F5CEC1 (ntdll) RtlUserThreadStart
	
Can't destroy Transform component of 'Blank Spatial Mesh GameObject'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
	0x00007FF78458E2EC (Unity) StackWalker::GetCurrentCallstack
	0x00007FF7845917A1 (Unity) StackWalker::ShowCallstack
	0x00007FF782CEFA45 (Unity) GetStacktrace
	0x00007FF784FB42B0 (Unity) DebugStringToFile
	0x00007FF783FFA04F (Unity) CanDestroyObject
	0x00007FF783FFD29F (Unity) DestroyObjectHighLevel
	0x00007FF784011633 (Unity) DestroyWorldObjects
	0x00007FF7827B7254 (Unity) EditorSceneManager::RestoreSceneBackups
	0x00007FF782D280CE (Unity) PlayerLoopController::ExitPlayMode
	0x00007FF782D37E57 (Unity) PlayerLoopController::SetIsPlaying
	0x00007FF782D3AB88 (Unity) Application::TickTimer
	0x00007FF782FF8E5B (Unity) MainMessageLoop
	0x00007FF783002867 (Unity) WinMain
	0x00007FF78594C9CE (Unity) __scrt_common_main_seh
	0x00007FF859226FD4 (KERNEL32) BaseThreadInitThunk
	0x00007FF859F5CEC1 (ntdll) RtlUserThreadStart
	
Can't destroy Transform component of 'Blank Spatial Mesh GameObject'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
	0x00007FF78458E2EC (Unity) StackWalker::GetCurrentCallstack
	0x00007FF7845917A1 (Unity) StackWalker::ShowCallstack
	0x00007FF782CEFA45 (Unity) GetStacktrace
	0x00007FF784FB42B0 (Unity) DebugStringToFile
	0x00007FF783FFA04F (Unity) CanDestroyObject
	0x00007FF783FFD29F (Unity) DestroyObjectHighLevel
	0x00007FF784011633 (Unity) DestroyWorldObjects
	0x00007FF7827B7254 (Unity) EditorSceneManager::RestoreSceneBackups
	0x00007FF782D280CE (Unity) PlayerLoopController::ExitPlayMode
	0x00007FF782D37E57 (Unity) PlayerLoopController::SetIsPlaying
	0x00007FF782D3AB88 (Unity) Application::TickTimer
	0x00007FF782FF8E5B (Unity) MainMessageLoop
	0x00007FF783002867 (Unity) WinMain
	0x00007FF78594C9CE (Unity) __scrt_common_main_seh
	0x00007FF859226FD4 (KERNEL32) BaseThreadInitThunk
	0x00007FF859F5CEC1 (ntdll) RtlUserThreadStart
	
Can't destroy Transform component of 'Blank Spatial Mesh GameObject'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
	0x00007FF78458E2EC (Unity) StackWalker::GetCurrentCallstack
	0x00007FF7845917A1 (Unity) StackWalker::ShowCallstack
	0x00007FF782CEFA45 (Unity) GetStacktrace
	0x00007FF784FB42B0 (Unity) DebugStringToFile
	0x00007FF783FFA04F (Unity) CanDestroyObject
	0x00007FF783FFD29F (Unity) DestroyObjectHighLevel
	0x00007FF784011633 (Unity) DestroyWorldObjects
	0x00007FF7827B7254 (Unity) EditorSceneManager::RestoreSceneBackups
	0x00007FF782D280CE (Unity) PlayerLoopController::ExitPlayMode
	0x00007FF782D37E57 (Unity) PlayerLoopController::SetIsPlaying
	0x00007FF782D3AB88 (Unity) Application::TickTimer
	0x00007FF782FF8E5B (Unity) MainMessageLoop
	0x00007FF783002867 (Unity) WinMain
	0x00007FF78594C9CE (Unity) __scrt_common_main_seh
	0x00007FF859226FD4 (KERNEL32) BaseThreadInitThunk
	0x00007FF859F5CEC1 (ntdll) RtlUserThreadStart
	
Can't destroy Transform component of 'Blank Spatial Mesh GameObject'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
	0x00007FF78458E2EC (Unity) StackWalker::GetCurrentCallstack
	0x00007FF7845917A1 (Unity) StackWalker::ShowCallstack
	0x00007FF782CEFA45 (Unity) GetStacktrace
	0x00007FF784FB42B0 (Unity) DebugStringToFile
	0x00007FF783FFA04F (Unity) CanDestroyObject
	0x00007FF783FFD29F (Unity) DestroyObjectHighLevel
	0x00007FF784011633 (Unity) DestroyWorldObjects
	0x00007FF7827B7254 (Unity) EditorSceneManager::RestoreSceneBackups
	0x00007FF782D280CE (Unity) PlayerLoopController::ExitPlayMode
	0x00007FF782D37E57 (Unity) PlayerLoopController::SetIsPlaying
	0x00007FF782D3AB88 (Unity) Application::TickTimer
	0x00007FF782FF8E5B (Unity) MainMessageLoop
	0x00007FF783002867 (Unity) WinMain
	0x00007FF78594C9CE (Unity) __scrt_common_main_seh
	0x00007FF859226FD4 (KERNEL32) BaseThreadInitThunk
	0x00007FF859F5CEC1 (ntdll) RtlUserThreadStart
	

So the things I don't understand. We're not trying to destroy any transforms in our implementation. We call Destroy on the GameObjects themselves.

I'm wondering if these errors are coming from somewhere in Unity's internal implementation as the scene is cleaned up.

@StephenHodgson
Copy link
Contributor

Edited the errors with the internal callstacks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants