Unity WebGL performance issues on Retina (MacBook) - performance

I developed a WebGL Unity 3D app with a 3d character that can navigate in the environment (mouse navigation and WASD) and interact with some objects.
On windows it is all great and the FPS is 45-60 and the resolution is 1920 * 1xxx.
On Macs the performance drops to 13-17 because of Retina and the resolution is 3300 * 2100 (double the laptop's resolution).
How can I handle this ?
Any help would be appreciated.Thanks in advance!

Thank you Siba for your hint. Though I had to search a bit how to actually do it for 2019.4.
Just in case anyone stumbles upon this, I did this in JavaScript, right before UnityLoader.instantiate:
window.devicePixelRatio = 1;
If you're using newer Unity versions, this thread might also help:
https://forum.unity.com/threads/webgl-retina-scaling.853144/

In Unity if you go to Edit menu > Project settings > Player | Resolution and Presentation : Display Resolution Dialog. You can change the default settings for your program.
Here you can see the default ratio's your screen will be displayed in
This is a course on unity's performance optimization
For more information go to link
Or the Unity Desrciption itself.

Okay so if you go into webGL, in unity itself. so: WebGL > WebGL Player Settings > Resolution and Presentation.
you will find this screen.
Setting Function
Default Canvas Width
Set the width of the WebGL canvas element.
Default Canvas Height
Set the height of the WebGL canvas element.
Run In Background
Enable this option to allow your content to continue to run when the canvas or the browser window loses focus.

I needed to add a JavaScript code to the html file to set the DPI to 1

Related

How to change the camera in three.js / editor using only scripts?

How to change the type of camera used in three.js/editor? I want to do this using scripts, and not using the add camera button (Add → Orthographic Camera). I try to announce the camera again, but I can't. I'm trying to check the view of the main camera using the function (console. log(camera)) — the console shows that the camera has changed. But, when you click the PLAY button, the view remains the same as it was. Thank you for your help and feedback, I am very grateful for this!
It is not possible to do what you are looking for since cameras are handled within the editor. You can't use scripts to change the type of camera used for rendering.
In general, there is no full support for orthographic cameras in the editor. For example the editor's controls only support perspective cameras as well as the app player that playbacks exported/published applications. However, there is a feature request at GitHub that tracks the improvement of orthographic camera support:
https://github.com/mrdoob/three.js/issues/16008

VS2010 Form being cropped at run time on Laptop

Hi I have developed a VS2010 application in Windows 7. I am also using InstallShield Premier to create an Setup.exe/MSI as usual.
The problem is that my splash screen is being cropped on the right hand side when I install on to a laptop which has a screen resolution of 1366 x 768.
(On a desktop of 1900 x 1080 it is fine, both the forms are visible).
My main form is of size 1330 x 848 and appears ok albeit snug.
The Splash screen form is only of size 562 x 398 so this should in theory fit well easy but this form is being cropped by say 25% on the right. So only 75% of the Splash screen is visible missing out the "Skip" button on the right.
This form does have a progress bar using a timer and a centre logo, can't think why this would have any bearing.
I am aware if the Form Autuosize attribute, Autuosize to True and have tried looking in the Installshield parameters to no avail.
I have recently added a background (and stretch to fill) to both Forms which may have some bearing on the matter but doubt it.
Any help would be greatly appreciated,
Thanks in advance.
have you set your splash screen form startposition to centerscreen in properties window? maybe you mess with it and it now starts at the right side.
since you created it in a higher resolution display and run it in a lower resolution will likely cropped. use the autosize from the properties window.

How to customize the screen size of ARC-Welder?

I would like to change the screen size of the ARC-Welder chrome-extention to a 7inch screen - displayed on my pc - to test an app on different screen sizes.
Can this be done using for example the meta-data input?
Similar to a question that I asked recently but I think shares the same answer. It seems that there are few choices when it comes to form factor, and based on the answer to my question I think that you can only use the three form factor presets for now.
(from #Elijah Taylor)
The size of the window is not configurable per activity*, but the orientation is. The two options in ARC Welder that control the window are:
Orientation: This is either landscape or portrait, which will be the default orientation for your app. However, if you set a screenOrientation on your Android activity, this can override the orientation per activity, with the window rotating to compensate. There is a performance cost to rotating this way because the plugin will be rotated via CSS.
Form Factor: This is one of phone, tablet, or maximized. This controls the overall size of your app globally.
but for Chrome 42 and up you can use the metadata {"resize": "reconfigure"} to allow arbitrary user resizing. Your app must be able to relayout with a variety of aspect ratios and resolutions in this mode.
My question at:Android ARC app for chrome, set size of windows for different Activities/Layouts
You can Use this MetaData :
{
"resize":"reconfigure"
}
just thought i'd mention that there is also "formFactor": "fullscreen" if want to test full screen it also works with "resize":"reconfigure"

UI doesn't show up in #Screen tab in Unity 4.6

I have just upgraded Unity to version 4.6 and tried to create a button by Create -> UI -> Button.
However, this button doesn't show up in #Screen tab but it does in Game tab.
Please look at the screen shoot below:
Another question is: The default width and height when creating a new button is 160 x 30. When I change the source image with my own image button, I have to change the width and height parameters in rect transform. Is there any faster way to automatically obtain new width and height based on the image which I insert?
Thank you very much!
First, double click the button in your hierarchy and see that it indeed does not show in the Scene view, excluding any kind of zoom problem. (By the way, I'm assuming you mean "Scene" and not "Screen", right?) Things in different cameras or canvases might have very different scales but appear correctly in the Game view. I don't know how used you are to Unity, so I'm sorry if this sounds obvious. :)
Next, check the dropdown labeled "Layers" on top of Unity's editor, to the right of the Play, Pause and Step buttons. See if the layer of your button (which in this case is "UI") is visible. It should have an open eye icon next to it.
Regarding your other question, after dragging your sprite to the Image component, you can press the "Set Native Size" button, which will set the size of your object to the dimensions of your Sprite. Regarding the new UI, I think this is as automatic as it gets. Note that "Set Native Size" will only appear if your Image type is set to Simple (probably what you want) or Filled in the component.
I had the same problem before and here's a possible solution.
By default, the editor camera (Scene Tab) renders the World Space,
so your Canvas component's render mode should be set to "World Space".
The problem may only occur when you're trying to (or supposedly) render your UI in Screen Space - Overlay or Screen Space - Camera in the Canvas component.
So if you want to properly edit UI objects in the scene tab/window; set the Canvas component's render mode to World Space.
We don't have this problem in Unity 4.x before because I think Unity automatically renders any render mode from the Canvas component, however, that doesn't happen in Unity 5.x. I'm guessing it's either intentional that they do that or it's a bug on Unity UI feature.

OS X: update draw during fullscreen animation

I am currently programmatically enabling fullscreen in an OS X 10.7+ app, via the techniques described in this apple guide, that uses OpenGL to renderer its views. Is it possible to enable per-frame screen updates during the full screen animation? Currently, it seems like a screenshot is taken before and after fullscreen is entered and there is an automatic alpha fade between the two.
I would like to instead redraw the content at every frame so that there is a smooth fade between the two sizes.
You probably want to look at the Custom Full-Screen Presentation Animations section in NSWindowDelegate documentation

Resources