So I have an app with several scenes that coorspond to books (but that doesn't matter). Each scene has the same setup, ARCamera, various ImageTargets, etc.
One of my features that exposes this issue relatively often is taking screenshots. When the screenshot is performed, I switch to another UI screen, which displays the screenshot you just took, lets you annotate, send to social networks, whatever. Anyway I found that it was a good user experience to stop the AR while this screen was up, otherwise you'd hear whatever random activitiy going on behind the screen depending on what page they took a screenshot of. So I disable vuforia during this time. When the user closes the screenshot display UI screen, I re-enable vuforia. Most of the time it works, but about 10% of the time it doesn't come back. It's just black.
The user can fix it themselves, by opening the book selection and just re-loading that scene, but obviously that's not right. So I was looking for a way to detect the problem has occured and then reload it myself or kick it on the butt to try and re-init. But i haven't found a good way to do the first part yet...detecting that vuforia is having some issue.
I had planned to just watch and see if OnInitialize gets called....if not after some amount of time...then do something about it. But, it only gets called once, ever. If you disable and enable QCARBehavior...the subsequent times, even when it does get initialized, that event never happens.
I guess it's because I'm not properly disabling QCAR.
How to properly shut down the QCAR stuff, and safely (without fail) enable it again? Right now I am just doing this...
QCAR = go.GetComponent<QCARBehaviour>();
QCAR.enabled = false; and later doing QCAR.enabled = true;
(fails some percentage of the time).
Alternative question....how to verify and insure that vuforia runs. This was just one example of it failing to start...there are others. About 10% of the time of a fresh launch of the app, the first scene to load will fail (vuforia, black screen, everything else works, UI, etc) to start. To fix, just do it again until it does start.
This is basically the only showstopper remaining for this app.