How to get the viewport center

Hello, I’ve seen some other questions about this but I am having a problem, I guess with my HUD. When I use Get Viewport Size for my Player Controller, it returns 0. I have a HUD set up but I’m not sure what it’s missing so that Get Viewport Size doesn’t return 0. Any help is much appreciated. Let me know if you need any further information!

You should get the size of the render window in pixels with your “Event Receive Draw HUD”.

It two outputs “Size X” and “Size Y”. They represent the size of the window in which the game is played.
The center would be a Vector2D from “Size X / 2” and “Size Y / 2”.

If anybody got here from google and looking for a more up to date answer. Here is how you get the middle of the viewport with the new widget system:


Thx you save me

Should clarify, this needs to be run on a widget that occupies the whole screen. This returns the center of the current widget.

1 Like