0

I am developing a C# WPF application. I embedded Unity in a syncfusion:DockPanel as a process. (Base on EmbeddedWindow Unity exemple)

When I start the application an open the dock panel, Unity get the focus and everything works fine, keyboard input, mouse input. Although WPF doesn't receive any key input anymore (ex.: Ctrl+S won't be registered by the application).

As soon as I click on anything else, Unity looses it focus and I am not able to give it back. I can still use the left and right mouse click but any other input is not registered by Unity. When I try the mouse wheel over the Unity, WFP doesn't even register the PreviewMouseWheel event. The focus stay on the last control I selected.

I managed to make the keyboard input works by using a two-way NamedPipe to pass keyboard input from WPF to Unity. But I can't pass the mouse wheel input since it's not getting pickup by WPF.

I tried most of the exemple found on Unity or Stackoverflow forum but nothing seems to works properly.

  • ActivateUnityWindow
  • RegisterRawInputDevices
  • RedirectStandardOutput
  • SetParent
  • SetForegroundWindow
  • Run as Administartor

My solution so far is to call ActivateUnityWindow() when Unity is left clicked. But it's not perfect since you always need to click before using mouse wheel input or other input (disable for now). Idealy, both Unity and WPF need to register all input.

Armandas
  • 2,276
  • 1
  • 22
  • 27

0 Answers0