Search Unity

Question Scaling issues when running WebGL inside a iframe

Discussion in 'Web' started by Tech-Labs, Feb 19, 2024.

  1. Tech-Labs


    Feb 5, 2014
    I have a Unity (2022.3) app that I need to run in an iframe (inside a Qualtrics survey).
    This is what I use:

    <iframe name="WGiframe" height="975" width="720" src=";var2=2"></iframe>

    I've edited the default index.html and removed the footer as I do not want the logos or full-screen button.
    The settings used to work fine, but in my updated app it won't work anymore.
    I've got my canvas set to 600(w)x960(h) in Unity.

    The desktop version looks fine, but the mobile (testing on iOS) is way too big. When I rescale the iframe the Unity container remains too big.
    When I force the canvas scale to 100% (w & h) in the index.html, the webgl app appears at about 1/4 size of the screen and the iframe.

    Without the iframe the app nicely fills the screen of the mobile, so no problem there either.

    I'm lost in how to get the numbers so that both the dekstop and the mobile versions work when using iframe!
    Last edited: Feb 19, 2024