Unity3d Embedding WPF Tutorials
- Create a Class library project
- Create a Windowform custom control (UserControl)
1). Introducing Untiywebplayer COM Components
2). Drag the component into the UserControl and set the Dock property to fill so that it fills the entire control
3) After deleting untiywebplayer, generate file
3). Add a class public reference to the Unitywebplayer in the program. The purpose of this is to be able to manipulate it later (or not to add it)
4). Generate, there will be three DLL files in the bin, only two are useful. One is axinterop.unitywebplayeraxlib the other is the DLL for the custom component you defined.
- Bring those two useful DLLs into our WPF project. And then introduce System.Windows.Forms and Windowsformintegration.
- Introduces the namespace of our custom control in the Window tab of WPF XAML. such as: xmlns:unity= "..." In <Grid>, add a <WindowsFormHost> tag that is used to host our WindowsForm custom components. And in which to add such as: <unity:unityplayer x:name= "Unityplayer";. In this way, Unitywebplayer is embedded in WPF.
The problem may be that the component is not loaded,
Unity3d Embedding WPF Tutorials