protected override async void OnLoad(EventArgs e) { base.OnLoad(e); await _controller?.RegisterAsync(); _unityLibrary = new UnityProcess(@"UnityLibrary\UnityLibrary.exe", _splitContainer.Panel2.Handle); //_unityLibrary = new UnityDLL(@"UnityPlayer.dll", _splitContainer.Panel2.Handle); _splitContainer.Panel2.SizeChanged += (s, e) => _unityLibrary?.ResizeUnityWindow(_splitContainer.Panel2.Width, _splitContainer.Panel2.Height); }
protected override async void OnClosed(EventArgs e) { base.OnClosed(e); (_unityLibrary as IDisposable)?.Dispose(); _unityLibrary = null; await _controller?.UnregisterAsync(); await _controller?.DisposeAsync(); _controller = null; await _channel?.ShutdownAsync(); }