/// <summary> /// Method called when this behaviour is scheduled to be destroyed. /// OnDestroy will only be called on objects that have previously been active. /// </summary> void OnDestroy() { if (_trackerPlugin != null) { _trackerPlugin.StopInput(); _trackerPlugin.DeinitPlugin(); _trackerPlugin = null; } if (_lineMaterial != null) { Material.Destroy(_lineMaterial); _lineMaterial = null; } }