Embedding in electron and resizing causes webgl instance to become unrepsonsive
JakeSchroeder opened this issue · comments
Please avoid duplicates
- I checked all open issues and discussions and none of them matched my problem.
Language and Compiler
Babel and WebPack TypeScript
What environment are you using?
Local Development Server
When does your problem occur?
When the Unity App is running
What does your problem relate to?
The problem seems Unity related
React-Unity-WebGL Version
^8.7.4
React Version
^17.0.2
Unity Version
2020.3.21f1
What happened?
Firstly thank you for this amazing and powerful project.
I am trying to embed the unity build in my electron renderer.
It works as expected however, I am running into some resizing/resolution issues that are causing some unexpected behavior.
export default function Gizmo() {
const unityContext = new UnityContext({
loaderUrl: '/public/Build/Build.loader.js',
dataUrl: '/public/Build/Build.data',
frameworkUrl: '/public/Build/Build.framework.js',
codeUrl: '/public/Build/Build.wasm',
});
return (
<Box id="GizmoViewer" h="100%" w="100%" bg="#121212">
<Unity unityContext={unityContext} style={{ width: '100%', height: '100%' }} />
</Box>
);
}
After fullscreening the app and then unfullscreening, the webgl instance becomes unresponsive and I get this message:
Performance Warning: Recreating Offscreen FBO (2358x2340 => 2358x2370)
Quitting....
Done
How can I avoid the app quitting when changing the resolution?
Reproducible test case
No response
Would you be interested in contributing a fix?
- yes, I would like to contribute a fix
Update:
I added overflow hidden to the html and body of the renderer, I made everything else in the renderer position absolute so it overlays the webgl canvas and now the webgl canvas is being set to the body width and height which is correct.
This fixed my issue and now is no longet showing the performance issues in the console
Second Update:
I am still getting this conosle warning when resizing my browser:
Performance Warning: Recreating Offscreen FBO (1920x1200 => 2400x1880)
I found this https://forum.unity.com/threads/webgl-problem-performance-warning-recreating-offscreen-fbo-1920x1200-300x150.891103/ but the fix mentioned didnt work.
Why is the performance warning showing up and what does it mean?
Hi Jake!
I've never encountered this problem before. But it seems to be unrelated to this module, so I can't help you any further. I recommend keeping an eye on the Unity forums and perhaps opening a ticket in the Unity bug reporter.
For the time being, I'll convert this issue into a discussion so others might help you out.
Best of luck and happy coding!