I have a WPF application embedding a Unity3D application similar to this: Embed Unity3D app inside WPF application
The embedding is done into a WPF Page using WindowsFormsHost and WinForms:Panel
<WindowsFormsHost><WinForms:Panel x:Name="MyGame"/></WindowsFormsHost>
Now, my application requires me to show different Scenes of my Unity.exe on different pages in my WPF app. For example on Page1 the Unity.exe displays Scene1, and on Page2 the Unity.exe displays Scene2. I have a TCP communication to switch between scenes.
One way to achieve this would be to kill the process running Unity.exe and restarting it every time the user navigate to a new page. However, this will cause the user to wait for the Unity.exe to load every time. Therefore, is it possible to embed an .exe file running on one process and displayed it on multiple WPF pages? Somehow, I like to have the process running in the background when the user navigates to ordinary pages without the embedding.
My intuition says that embedding the .exe file into a User Controls might be a possible solution, but I did not find sufficient information on this so far.