How to get current screen size/resolution?
I'm trying to get the screen size/resolution of the game but neither
Also the tutorial posted by rama isn't of very much help to me as it lists all supported resolutions but i just want to know the current resolution that's being used. How could i get the current resolution via C++?
asked Sep 07 '14 at 11:11 PM in C++ Programming
Viewport Size is NOT the same as Resolution
They Are Two Separate Metrics
Viewport Size relates to how much screen space the game occupies. For example, you can play a game with a resolution of 1280x720 on a 2560x1440 monitor.
When playing fullscreen for this example, you will have:
This is important because (at least one my machine) UMG, text, UI elements, etc are displayed using the Viewport Size and not the Resolution in order to remain clear and crisp when playing lower-resolution games on larger monitors.
Get Viewport Size / Get Resolution
How to Get Viewport Size and Center From Anywhere
Here's how you can get the viewport size and center from anywhere in your code base!
Engine.h not EngineMinimal
To be able to use the above code replace this in YourProject.h
It's not just visible in blueprint because that node is representation of C++ function and you can see how it get size here:
But this return size of HUD canvas which does not need to be screen size, in engine rendering field is called viewport, so logicly you should serch by this term
you can get to that function from UGameViewportClient then from Viewport varable there and you can access local GameViewportClient from GetWorld()->GetGameViewport()
Follow this question
Once you sign in you will be able to subscribe for any updates here