Problem with Get Viewport Size returned Value

Hello,

We have a problem with the returned value of the fonction “Get Viewport Size”.

When we perform the test with the Iphone5S windows size, the value returned is 1000.

If the windows size is configured under the value around 1000, the returned value of size Y is the good one.

We use this value (and need the correct one) to calculate the ratio of the screen.

Does anybody else met similar issue or got any solution for this problem?

Thanks in advance!

Tapator

Hi PierreMaux,

Which version of the editor are you currently using? I just tested this in 4.4.1 and couldn’t get your results. 640x1136 was the values returned.

Also, could you provide some additional screenshots showing how you are using these values?

Thanks for your answer.

I use UE 4.2

We see the setup 640*1136 for new windows launch. But during the simulation the Y value is incorrect (1030)

Ah, I see. When using Simulate or PlayInEditor you will always get the perspective viewport size. You will need to play in New Window mode, Standalone mode, or Mobile Preview to get the correct window size. If using New Window mode, make sure to enable ‘Always center window to screen’.

As a workaround, you could grab the edges of the viewport and drag it to the approximate size you need, although this isn’t perfectly accurate it may get you by enough to simulate during development.

Another idea would be to feed the values 640x1136 into the blueprint manually while developing, then change the functionality back when you go to publish.

I hope this gives you some ideas.
TJ

Hi TJ,

Sorry for late reply.

My version is 4.2.0.

I played the game using New windows mode (640*1136 Ipad5), not Simulate or PlayInEditor. So, I dont understand why return Y value is wrong… Actually 1030 on the screen shot :

This is all my camera setting :

Thanks again ^^

Many thanks, is perfect :smiley:

Do you have ‘Always center window to screen’ enabled for Play in New Window mode? If you don’t, this will cause it to return a different value than the set size.

14350-ahub_viewportsizereturn.jpg

I’m having this same issue where get viewport size doesn’t return the correct viewport size when I Play in New Window. Always center has no effect on this behavior. Can this get entered as a bug?

Further testing reveals it’s returning the entire window size not the rendered viewport size.