I´m actually using Unity WebGL in an iframe in my webapplication.
The reason for the iframe is because unity doesn´t quit correctly (script files still exist on DOM) after the destroy of a component. I cannot quit the component automatically because i do not have the full control over all navigation scenarios. ==> With an iframe i do not have this problem.
But actually i can not route the right-click event to my WebGL application. In my Unity-Project i want to use the pressed “right-mouse-click”. Does anyone knows a solution for this problem?
Afaik right mouse button always brings up the browser‘s context menu and you have to prevent that menu from appearing with some javascript. You can find that on google specific to Unity, or the general version:
Hello, let me first say thank you for offering any help; please let me know what additional info would be helpful.
I see that you are using an iFrame to display a WebGL build and may be able to help.
I am working on an application that I have built for WebGL. It is a large project (~240MB) and after updating it recently, I can not get it to run in an iFrame. The previous version worked perfectly (2020.x.x LTS’s) but after upgrading the project to URP/2021.x.x LTS, I can not play it from an iFrame.
After uploading the build to WordPress, I can locate and click the index.html file and open up the build successfully with no issues at all. However, if I create a page and use custom HTML to create an iFrame, and set the source as the index.html, I get errors. Please note, that the build opens successfully if I directly clicked and ran the index.html file directly as it cached the files on my browser. But if I clear the cache and navigate to the page with the iFrame, I again see errors. The build just stops loading between 20-60%, and sometimes has an Abort modal pop-up. I have tried different builds as well related to compression (gzip, gzip with decompression fallback, brotli, brotli with DF, not compressed at all, etc).
In Network, the GET request is returning with a 206, but shows (failed)
Any help would be VERY much appreciated, thank you.