Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Problem with Get Viewport Size returned Value


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. alt text Does anybody else met similar issue or got any solution for this problem?

Thanks in advance!


Product Version: Not Selected
more ▼

asked Aug 25 '14 at 02:34 PM in Blueprint Scripting

avatar image

28 8 10 64

avatar image TJ V ♦♦ STAFF Aug 27 '14 at 09:16 PM

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?

avatar image PierreMaux Aug 28 '14 at 02:14 PM

Thanks for your answer.

I use UE 4.2 alt text We see the setup 640*1136 for new windows launch. But during the simulation the Y value is incorrect (1030)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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

more ▼

answered Aug 28 '14 at 05:55 PM

avatar image

41k 1009 183 494

avatar image PierreMaux Aug 31 '14 at 04:50 PM

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 : alt text

This is all my camera setting : alt text

Thanks again ^^

avatar image TJ V ♦♦ STAFF Sep 02 '14 at 01:50 PM

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.

alt text

avatar image 00k_ Oct 08 '18 at 04:32 AM

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.

avatar image PierreMaux Sep 02 '14 at 01:59 PM

Many thanks, is perfect :D

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question