- Home /
Lag issue when WPF content control holding a Unity3D app is hidden
My project involves Embedding my Unity3D app inside my WPF(Windows Presentation Foundation) application. I have achieved this by starting the Unity3D inside of WPF with the -parentHWND argument, done similarly like this.
The issue I am having is when the content control holding the Unity3D app is set to hidden inside of WPF. When this happens my entire machine lags considerably. Things like typing or clicking a button, in any running app including windows itself, takes a second or two to respond to input.
I also have a FPS counter showing on UI inside of Unity3D, its calculating the FPS by doing (1/Time.unscaledDeltaTime) in lateUpdate and averaging that value over that past 10 lateUpdates. It normally reports an FPS of 60, but when I set the content control from hidden back to visible, the FPS counter reports a really high FPS (well over a thousand) but quickly goes back to 60.
This makes me believe that Unity3D dosen't know how to handle having its window hidden like that, and just runs as fast as possible thus slowing down my machine. however that is just my best guess as to what is going on. any help or insight as to whats going on and why is greatly appreciated.