void OnDestroy() { if (_receiver != System.IntPtr.Zero) { PluginEntry.DestroySharedObject(_receiver); _receiver = System.IntPtr.Zero; } if (_sharedTexture != null) { Destroy(_sharedTexture); _sharedTexture = null; } if (_fixedTexture != null) { Destroy(_fixedTexture); _fixedTexture = null; } }
void OnDisable() { if (_sender != System.IntPtr.Zero) { PluginEntry.DestroySharedObject(_sender); _sender = System.IntPtr.Zero; } if (_sharedTexture != null) { if (Application.isPlaying) { Destroy(_sharedTexture); } else { DestroyImmediate(_sharedTexture); } _sharedTexture = null; } }