In 2019.x, the result of setting the canvas element width and height was update to Unity’s C# Screen.width and Screen.height. It also updated the GLctx viewport.
In 2020.x it seems to do nothing.
Setting canvas element style width and height, updates Unity’s C# Screen.width and Screen.height and the GLctx viewport, but it also updates the actual canvas area on the page (clientWidth and clientHeight).
Is there an internal method that can set what Unity thinks is the Screen.width or Screen.height?
I don’t think that it’s a bug.
There’s no documentation that define those behaviors, and in the first place it was a hack even in 2019.x.
Maybe it should be a feature, but then Unity needs to define such a feature.
And if it’s a feature, there’s more than one part:
Set Unity’s screen/display size.
Enable more than one “display” for Unity in WebGL.
Enable setting Viewports that are out of the display area of Unity.
Found a solution!
I override “JS_SystemInfo_GetCanvasClientSize” and “JS_SystemInfo_GetPreferredDevicePixelRatio” using a “.jslib” file.
It works both on 2019.4 and 2020.1.