BUG: Unity Example: Streams do not stop when uninitialised OnDestroy, slows next scene down to 30fps

Streams do not seem to stop properly even when calling the UninitialiseStreams function. I think this is because that function doesn’t actually stop the streams, it just disposes the listeners/readers

I have an app running at 60fps, and I’ve included the Astra SDK TestScene example

When I switch from the TestScene back to my scene, the framerate drops to 30. (I know the Color streams cause Unity to run at 30fps)

Disabling the Color streams before switching fixes this
Preferably, calling the following on OnDestroy before calling UninitialiseStreams also fixes the issue

_depthStream.Stop();
_colorStream.Stop();
_bodyStream.Stop();
_maskedColorStream.Stop();
_colorizedBodyStream.Stop();

just thought I’d point out it’s an issue in the Unity examples anyway

thanks
J

Apart from this issue, do you know why color stream fix 30fps?
It seems intended but I don’t understand why it works like this.

30fps is just what the camera Color stream runs at i think… although I’m not sure why it’s slowing the overall app framerate (i think i’ve had it running at 60 sometimes though)

I’ve also had trouble trying to switch from a scene where I turn the camera on, to a scene where I turn the camera off. (indicated by whether the red light is on or not)

I don’t think it likes being uninitialised and reinitialised in the same session. I had to save PlayerPrefs telling it whether to run the camera or not, and restart my app completely

I’m not sure if it has something to do with the way Unity will tear down game objects (ie OnDestroy etc) in a random order and therefore something is not firing on the sdk correctly… It’s not crashing, i just cant seem to start/stop/start the camera correctly