[SOLVED] Nuitrack crashes when switching scenes

Hello,

I am developing a sports movement tracking application. My application has an interface to launch exercises. When I click on an exercise name, the scene changes and the Nuitrack scene is launched (to track the execution of the exercise).

Everything works fine but when I leave the Nuitrack scene to come back to the interface, all Unity starts to crash.

I tried to find a solution : disable Nuitrack Script when I leave the scene : it works partially and avoids the crash when I go back on the interface. However when I go back to the Nuitrack scene, this is where Unity crashes.

I think the problem comes from “DontDestroyOnLoad” of NuitrackScript.

Thanks in advance for your help.

Hello @simonlojelis
Try to remove this line from the script, will the problem persist?

1 Like

Hello,

To avoid the crash I added

void OnEnable()
    {
        NuitrackManager.onColorUpdate += DrawColor;
    }

    void OnDisable()
    {
        NuitrackManager.onColorUpdate -= DrawColor;
    }

on the DrawRGBFrame function and I instantiated the Nuitrack script in my application’s loading scene so that it is only opened once.

I hope I’m clear and precise, because it’s been a few days since I found the solution and I’ve already forgotten what I did

1 Like