- Home /
Question by
d112570 · Apr 16, 2014 at 03:51 PM ·
resolutionscreen
print(Screen.currentResolution); not working
When I add this code
print(Screen.currentResolution);
In the console I get "Unity Engine.Resolution" and thats it. It is suppose to returns the current resolution of the desktop.
found in the http://docs.unity3d.com/Documentation/ScriptReference/Screen-currentResolution.html site
Comment
Best Answer
Answer by perchik · Apr 16, 2014 at 03:53 PM
Screen.currentResolution returns a Resolution
object which has .height
and .width
properties. Try this:
print(Screen.currentResolution.width+ " x "+ Screen.currentResolution.height);
yeah that will work, but just curious why the code in the document itself didn't work.
P.S. I would add a space in front of the x to separate the text. Thx.
Well the code did work, it just didn't produce the result you expected.