Embed Unity3D app inside WPF *without* having it take up the whole window

后端 未结 1 927
醉话见心
醉话见心 2021-01-15 21:32

I am trying to adapt the code posted in this question: https://stackoverflow.com/a/44059700

to allow me to embed a Unity3D app inside a WPF app.

This is my s

相关标签:
1条回答
  • 2021-01-15 22:17

    Use a WindowsFormsHost or HwndHost control in your WPF. The hwnd is in the host control's Handle property. So you can change this line to put Unity in just the host control.

    process.StartInfo.Arguments = "-parentHWND " + hwndHost.Handle.ToInt32() + " " + Environment.CommandLine;
    

    And remove the code that gets the hwnd for the floating frame

    HwndSource source = (HwndSource)HwndSource.FromVisual(p);
    
    0 讨论(0)
提交回复
热议问题