This is my code:
function OnGUI () {
var H = Screen.height;
var W = Screen.width;
var Ratio;
Ratio = H / W;
GUI.Label (Rect (10, 110, 100, 20), "Screen.width "+ W.ToString());
GUI.Label (Rect (10, 130, 120, 20), "Screen.height "+ H.ToString());
GUI.Label (Rect (10, 150, 120, 20), "Screen ratio "+ Ratio.ToString());
}
When i run it, it displays proper screen dimensions, but Ratio is always 0. Also when i try to operate on Screen.height or Screen.width (add to them etc.) they become zeros. I followed tutorials and copy/pasted code from documentation - the Screen.width and .height show ok only if i don’t try to use them in calculations. This is becoming frustrating, what am i missing here?
This happens both in editor and in build.