- Home /
Get webplayer resolution
Hi
I calculate webplayer resolution through javascript (on website). But how can Unity script get this resolution (to calculate positions of GUI elements etc.)?
This is like it worked before:
In the first frame, Unity script calls javascript function (on website) and the function calls unity script function with width and height parameters (which saves it to global variables). But I want unity to know it before the first frame. How to do this ?
I do not understand exactly what are you doing, but I assume that you call a function in Unity in a Start() method ? Then, maybe try Awake() ?
@contab009 I call it in second Update(), becasuse it didnt work with Start(). O$$anonymous$$, I will try awake
@$$anonymous$$mynator Are you sure that Screen.width and Screen.height are the same as width and height of webplayer ?
Yes absolutely. You can test it yourself by embedding the unity widget as 100% of the page size and debugging out the Screen.width/height values in e.g. OnGUI.
Answer by Tommynator · Oct 04, 2014 at 11:27 AM
What's wrong about using Screen.width, Screen.height and Screen.dpi?