Hello, your plugin for unity(3DxUnity3D) is causing 6 to 10 second hangs when entering game mode (because of the unloading and reloading domain, specifically the unloading part). This is extremely frustrating because it increases development time.
I have profiled Unity with your plugin and it looks like the disposing(closing) of your classes seem to be the culprit causing the hangs, disabling your plugin removes the hangs:
TDxNavLib.dll!NlClose
TDx.SpaceMouse.Navigation3D.dll!.NativeMethods.NlClose
TDx.SpaceMouse.Navigation3D.dll!TDx.SpaceMouse.Navigation3D.NativeNavlibWrapper.Close
TDx.SpaceMouse.Navigation3D.dll!TDx.SpaceMouse.Navigation3D.NativeNavlibWrapper.Dispose
TDx.SpaceMouse.Navigation3D.dll!TDx.SpaceMouse.Navigation3D.NativeNavlibWrapper.Finalize
Here is a stacktrace of an exception that occurs about 50% of the time when trying to dispose of the class, this might be part of the issue:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'NativeNavlibWrapper'.
at TDx.SpaceMouse.Navigation3D.NativeNavlibWrapper.Close () [0x00008] in <fcbcc8a5b031496896cbc0cf1e64d310>:0
at TDx.SpaceMouse.Navigation3D.Navigation3D.Close () [0x0002a] in <fcbcc8a5b031496896cbc0cf1e64d310>:0
at TDxUnity3D.CameraController.CloseConnection () [0x000b0] in C:\3DConnexion\3DxUnity3D\src\Editor\TDxController.cs:124
at TDxUnity3D.CameraController.Finalize () [0x00024] in C:\3DConnexion\3DxUnity3D\src\Editor\TDxController.cs:134
For additional information about the Unity Domain Reloading you can view these pages:
https://docs.unity3d.com/6000.2/Documen ... tails.html
https://docs.unity3d.com/Manual/configu ... -mode.html
I'm using Unity version 6000.0.41f1 and can provide more technical information if required.
Please look into this, thank you!
Unity plugin causing hangs when Reloading Domain
Moderator: Moderators
-
avg3dMouseEnjoyer
- Posts: 2
- Joined: Fri Mar 14, 2025 9:46 am
-
avg3dMouseEnjoyer
- Posts: 2
- Joined: Fri Mar 14, 2025 9:46 am
Re: Unity plugin causing hangs when Reloading Domain
I would like to add that SendMessageTimeoutW is called 3x by TDxNavLib.dll further down the TDxNavLib.dll!NlClose call, and each of these calls have a 2 second timeout resulting in a total 6 seconds. This explains why it hangs for 6+ seconds.
-
restoresup
- Posts: 1
- Joined: Tue Aug 12, 2025 12:35 am
- Location: https://ragdollhitstickman.io
Re: Unity plugin causing hangs when Reloading Domain
Hey, I can totally understand how frustrating those delays can be, especially when they add up during development. It looks like the issue is tied to how the plugin disposes of objects when unloading and reloading domains, which causes those hangs. Based on the stack trace you provided, it seems like the `NativeNavlibWrapper` is being accessed after it’s been disposed, leading to the exception. One suggestion might be to check if there's a more efficient way to manage the disposal process, or perhaps delay the unloading process until after Unity’s domain reload. If you haven’t already, it could help to reach out to the plugin’s support or development team with this detailed info to get a more targeted fix. Hope this helps!