arunityx icon indicating copy to clipboard operation
arunityx copied to clipboard

Unity Editor Crashes when Entering Play Mode with ARToolkitX

Open TyroneStaMaria opened this issue 2 years ago • 7 comments

Whenever we try to run our scene in play mode the editor crashes. We suspect the crash is caused by the ARX Controller or ARX Video Background scripts, since when we disabled these scripts the editor does not crash. We also tried to run play mode when the web cam is used by another program, and it did not crash. We tried to build it on android and it works, we also tried building on Windows and it also crashes. Does ARUnityX not work on Desktop computers yet?

Here is an excerpt from the crash log:

=================================================================
	Native Crash Reporting
=================================================================
Got a UNKNOWN while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
	Managed Stacktrace:
=================================================================
	  at <unknown> <0xffffffff>
	  at ARX_pinvoke:arwUpdateTexture32 <0x00089>
	  at PluginFunctionsARX:arwUpdateTexture32 <0x00052>
	  at ARXVideoBackground:OnVideoFrame <0x00068>
	  at UnityEngine.Events.InvokableCall:Invoke <0x00038>
	  at UnityEngine.Events.UnityEvent:Invoke <0x000da>
	  at ARXController:UpdateAR <0x001e2>
	  at ARXController:Update <0x000e2>
	  at System.Object:runtime_invoke_void__this__ <0x00087>
=================================================================
Received signal SIGSEGV
Obtained 30 stack frames
0x00007fff983aa85a (ARX) ARVideoSource::getFrameTextureRGBA32
0x000002651b3102ba (Mono JIT Code) (wrapper managed-to-native) ARX_pinvoke:arwUpdateTexture32 (intptr)
0x000002651b2fff43 (Mono JIT Code) PluginFunctionsARX:arwUpdateTexture32 (UnityEngine.Color32[]) (at ./Library/PackageCache/org.artoolkitx.artoolkitx-unity@7e205a297c/Runtime/Scripts/PluginFunctionsARX.cs:243)
0x0000026519eaa8e9 (Mono JIT Code) ARXVideoBackground:OnVideoFrame () (at ./Library/PackageCache/org.artoolkitx.artoolkitx-unity@7e205a297c/Runtime/Scripts/ARXVideoBackground.cs:252)
0x00000265bb8ebb69 (Mono JIT Code) UnityEngine.Events.InvokableCall:Invoke ()
0x00000265bb8eb3fb (Mono JIT Code) UnityEngine.Events.UnityEvent:Invoke ()
0x00000265bbb02813 (Mono JIT Code) ARXController:UpdateAR () (at ./Library/PackageCache/org.artoolkitx.artoolkitx-unity@7e205a297c/Runtime/Scripts/ARXController.cs:825)
0x00000265bbb020e3 (Mono JIT Code) ARXController:Update () (at ./Library/PackageCache/org.artoolkitx.artoolkitx-unity@7e205a297c/Runtime/Scripts/ARXController.cs:503)
0x00000265bb4572d8 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007ff80504e274 (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445)
0x00007ff804f8eb74 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3066)
0x00007ff804f8ed0c (mono-2.0-bdwgc) mono_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3113)
0x00007ff722ed9d14 (Unity) scripting_method_invoke
0x00007ff722eb7e34 (Unity) ScriptingInvocation::Invoke
0x00007ff722e9f4b4 (Unity) MonoBehaviour::CallMethodIfAvailable
0x00007ff722e9f5da (Unity) MonoBehaviour::CallUpdateMethod
0x00007ff72293bf7b (Unity) BaseBehaviourManager::CommonUpdate<BehaviourManager>
0x00007ff72294378a (Unity) BehaviourManager::Update
0x00007ff722b7464d (Unity) `InitPlayerLoopCallbacks'::`2'::UpdateScriptRunBehaviourUpdateRegistrator::Forward
0x00007ff722b535cc (Unity) ExecutePlayerLoop
0x00007ff722b53748 (Unity) ExecutePlayerLoop
0x00007ff722b5a025 (Unity) PlayerLoop
0x00007ff723b1c16f (Unity) PlayerLoopController::InternalUpdateScene
0x00007ff723b28d9d (Unity) PlayerLoopController::UpdateSceneIfNeededFromMainLoop
0x00007ff723b270a1 (Unity) Application::TickTimer
0x00007ff723f9e16a (Unity) MainMessageLoop
0x00007ff723fa39d0 (Unity) WinMain
0x00007ff725387dbe (Unity) __scrt_common_main_seh
0x00007ff85e717344 (KERNEL32) BaseThreadInitThunk
0x00007ff85f1c26b1 (ntdll) RtlUserThreadStart

TyroneStaMaria avatar Dec 18 '23 10:12 TyroneStaMaria

It does work on desktop platforms, and I've not observed crashes in ARVideoSource::getFrameTextureRGBA32 before. Can you supply some more information please?

  1. CPU type and architecture
  2. Windows version
  3. Webcam type and driver
  4. Unity version

philip-lamb avatar Dec 18 '23 19:12 philip-lamb

  1. AMD Ryzen 5 2600, 64-bit
  2. Windows 10 Pro version 22H2 OS Build: 19045.3803
  3. I am not super sure since I am using a generic webcam but this is what Windows is giving me image
  4. 2022.3.10f1

I tried to use my phone camera connected through IP and it does not crash and works properly. So I assume it might be a webcam issue

TyroneStaMaria avatar Dec 19 '23 02:12 TyroneStaMaria

Hello, I encountered the same problem as you, a crash occurs when playing on my windows. Have you solved this problem? How can you make it successfully open the camera and run it?

Heyn1999 avatar Jan 29 '24 07:01 Heyn1999

No I haven't solved it yet. I am using my phone camera as a webcam with droidcam or iriun webcam as a workaround

TyroneStaMaria avatar Jan 29 '24 14:01 TyroneStaMaria

Can you tell me which script I need to change to use the IP webcam? How to do that?

Heyn1999 avatar Feb 29 '24 10:02 Heyn1999

in the ARX Video Config in the ARToolkit Controller, you can find a dropdown where you can choose video source info list or nth camera. The ip camera app should be in the video source info list. If you can't select the video source, you can use the Nth Camera and input in the camera number the order in which the video source appears in the video source info list dropdown.

image

Alternatively, you can use splitcam as a virtual camera. Just use your webcam as source in the app and splitcam as the source in unity
https://splitcam.com/

TyroneStaMaria avatar Feb 29 '24 14:02 TyroneStaMaria

thank you! It does works.

Heyn1999 avatar Mar 01 '24 10:03 Heyn1999