How to get monitor/display resolution

ぐ巨炮叔叔 提交于 2019-12-07 13:31:03

问题


As you know, monitors and displays are manufactured with some resolution. I need to get monitor/display resolution. I don't mean resolution of game window/fullscreen, I mean physical resolution of monitor/display.

I need it to work both on Android and Windows.

EDIT :

I just found what i'm looking for is called NATIVE RESOLUTION


回答1:


Looks like i found solution. @Draco18s pointed to Screen class but what i'm looking for is called Display. Display class allows me to get native size of monitor or display in pixels. Looks like "Screen" class is used only for game window/full screen but for display as hardware device is used "Display" class. It was added to Unity3d very recently with multi-display support, this is reason why very few people knows about its existence.

To be more specific i was looking for Display.main.systemHeight and Display.main.systemWidth




回答2:


The Screen class is what you are looking for.

Particularly Screen.width and Screen.height.



来源:https://stackoverflow.com/questions/48347734/how-to-get-monitor-display-resolution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!