static void ReleaseResources() { if (_thread != null) { _thread.Dispose(); _thread = null; } }
static SenselMaster() { if (SenselDevice.GetDeviceList().num_devices > 0) { _thread = new SenselThread(); } #if UNITY_EDITOR // To release the internal objects on script recompilation. UnityEditor.AssemblyReloadEvents.beforeAssemblyReload += ReleaseResources; #endif }