void OnEnable() { #if !HOLOPLAY_NO_CLIENT Debug.LogError("Can't use depthPluginStatic without HOLOPLAY_NO_CLIENT defined! Use the depthPluginClient component instead."); Destroy(this.gameObject); return; #else pluginThread = new depthCamThread(); setTouchLerp(pluginLerp); thread = new Thread(new ThreadStart(pluginThread.runForever)); thread.Start(); #endif }
protected override void Cleanup() { 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 }