void shutDown() { if (pluginThread != null) { pluginThread.requestStop(); pluginThread = null; } //This reference shouldn't be null at this point anyway. if (thread != null) { thread.Join(); //this will cause a slight hiccup in the main calling thread, but without it can occasionally crash... thread = null; } //thread = null; //1 crash noted with this simpler method }
void OnEnable() { pluginThread = new depthCamThread(defaultThresholdInMeters); setTouchLerp(pluginLerp); // StartCoroutine("StartThread"); //} //private IEnumerator StartThread() //{ //yield return null; thread = new Thread(new ThreadStart(pluginThread.runForever)); thread.Start(); }