Problem with cleaning up before existing an app

Good day everyone,

I’m having a bit of an issue with a feature I’m implementing. The feature requires the manual creation of a RenderTexture in Unity.

My issue is if I close the app without destroying the RenderTexture I created, it causes Nebula to either run without showing anything on the glasses (I can still hear the laser pointer touching the apps), or freeze my phone and force it to restart.

Now I do have an OnDestroy function that removes the RenderTexture, but according to Unity manual, that function may not get a chance to be called if termiante the app, which seems to be the case.

Is there anyway to interrupt the NRSDK exit sequence to add mine first, or some sotra exit callback?

I may have a solution for this when in controller mode and the user has to use the GUI, but I can’t find a way around the system gesture in hand mode that prompts the exit message.

Any help or tips would be appreciated.