Get viewport size not working on packaged build

I’m trying to make my game fullscreen properly at the monitor’s native resolution. I’ve looked through a bunch of old questions and it seems like there is no easy way of doing this. What I’m trying to do is get the viewport size and then force fullscreen to the most likely screen resolution based off those values. My problem is that when I package my game and then test the packaged game, the resolution (which I’ve set to show on the HUD) shows as 0 for both X and Y. When I try it on Play in Editor, it gives me a value. Does anyone have any ideas why this would be?

Hi Hulkysaurus,

If I understand correctly the issue is that the value for view port size returns 0 in a packaged build. I was unable to reproduce this issue but there may be a flaw in my test. Here are the steps I took:

  1. In the level blueprint on tick get the viewport size and plug the value to a print string
  2. Package for windows(64-bit) and play
  3. Check that the value updates accordingly

I confirmed that the values returned the correct screen size.

P.S. The first two ticks did return 0 so maybe you need to wait for the screen size to initialize.

1 Like

Hi Ed,

This hasn’t solved my problem; I’d done what you’d done, but in a different blueprint. I’ve just tried doing it exactly as you described and I’m not getting anything on the screen from the print string node at all when I test my packaged game. In the editor it’s fine.

I’m unable to reproduce this issue on my end so I need you to do a couple things in order to determine if this is a problem with the engine or your project.

  • Could you create a blank project and print screen size on tick in the level BP then package for windows(64 bit) if the issue occurs you can stop here and let me know
  • Next if the issue was solved this may be due to your packaging settings or your project settings I would check the settings and see what you have different from the default settings

Let me know how things go and we can continue!

Hi Ed,

I’ve just tried this at home (I’m normally doing this at work, so my settings might be different there) At home in engine 4.13 in a fresh project this works fine on a 32 and 64 bit build. I’ll try it at work next week and see what happens there. As always, for the help.