Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How do I simulate iPhone resolutions on the Unity Game tester?

Discussion in 'iOS and tvOS' started by drew_s, Jan 29, 2015.

  1. drew_s

    drew_s

    Joined:
    Dec 9, 2014
    Posts:
    14
    So I'm working on a game right now, my first game with Unity, and I have it looking fairly nice in the "Game" panel when testing in the Unity application. However the resolution is set to "Free Aspect" and is obviously not close to being what it will look like on the iPhone when finished.

    I added my own custom iPhone 6 resolution to it (750x1334), however, when I set it to that, it is only displaying 381x677 due to the resolution of my monitor. And it looks really bad because it's cutting off a ton of the screen.

    Is there anyway that it can "simulate" the 750x1334 by cutting this screen size in half or something? Kind of similar to how the simulator works when developing iOS apps natively? It seems like this would be something very obvious but searching google, I don't see anything like that, and I'm wondering if it's just not possible.

    It is going to be tough to build and test every little thing by deploying to iOS and running it on my phone.

    I'm running 4.5 still, so if this is a new feature in 4.6 that I'll gladly upgrade, i Just haven't upgraded yet because everything is working fine now and I didn't want to mess with it.

    So does anyone have any suggestions?
     
  2. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,066
    Which build platform do you have set for your project? If it's set to iOS, you should have the resolutions available in the drop-down list.
     
  3. drew_s

    drew_s

    Joined:
    Dec 9, 2014
    Posts:
    14
    I do have the resolutions in the drop-down list, but the problem is my screen isn't large enough to display 750x1334 resolution in full, so it shrinks the resolution down to 381x677 to fit inside of the Unity application.

    Here is a screenshot of what I'm talking about. This isn't in full screen mode, but even in full screen mode, I don't have enough space. You can see that in the dropdown it's set to the iPhone 6, however below that it shows what resolution it's actually using.

    Is there anyway for it to "scale" the 750x1334 resolution to simulate it being that large, in that small area?

    That is what I meant by "similar to the iPhone simulator" because you can make it 50% where the simulator will be 1/2 the size, but it still acts as though it's in full resolution.
     

    Attached Files:

  4. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,066
    Not really sure what you mean - the view that Unity gives you IS scaled down.

    If the issue is that your UI elements are still "too big" in that scaled down version, that's to be expected as you need to deal with scaling of the UI yourself for resolution independence.

    Is that what your concern is?
     
  5. drew_s

    drew_s

    Joined:
    Dec 9, 2014
    Posts:
    14
    It's not actually scaling it down though.

    It is showing me a display of 381x677 pixels, instead of 750x1334 being scaled down by 50%.

    For example...

    If I had a button, that was say, 750px wide, in the 381x677 pixel view, it will show about 1/2 of that button.

    What I want it to do instead (and what the iPhone simulator does), is to show the entire button, but have the whole view scaled down by 50%.

    If it was showing the 381x677 with basically double the pixel density, THEN that would be doing what I want it to be.
     
  6. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,066
    That's exactly what I mean though.

    What GUI system are you using to make your button (for example)?
     
  7. drew_s

    drew_s

    Joined:
    Dec 9, 2014
    Posts:
    14
    I am using NGUI. And perhaps maybe some of my icons/labels are not anchored properly. I have some that are top/left and top/right aligned, don't seem to be working properly (or I could have something wrong in my settings, but it works fine in the larger view).

    It's also hard, in this view, to get the idea of what the button will look like at a full 750x1334 resolution if I can't simulate it in this view. The button width that I have is 160px wide. So it will fill A LOT more real estate on this view that is 366px wide vs the real estate it will fill on the true 750px wide view.

    So perhaps I am asking the wrong question here about this as well. Right now my buttons are 160px wide. And they look good in the "free aspect" view. I want them to be 160px wide in the 750px wide view, but since the view here in my Unity can only get to 366px wide, I'd like the button to look the same ratio in there as it would in the 750px view, which in this case, would be 80px wide I guess.

    But also, maybe this is also something that I'm just overlooking and is something totally different - but I also want my 3D view to "scale" which I am doing nothing of, so maybe that is also what this question is about.

    Like my 3D plane (the white that you see in that view) is a square plane, and if you make the pixel width of that window wider, you will see that the camera is about a 45 degree angle pointed down, and you see the other sides of the square plane come towards the camera and angle down on the viewport.

    So I basically want what I see in the game view there, in "free aspect" mode (which is probably like 900x900 or so in that window), is to see that "scaled" down to fit in the iPhone 6 resolution when I scale it down.

    So perhaps I am asking the wrong question at this point. And sorry if this looks all over the place, I am kind of thinking about many things as I go.

    EDIT:

    And I may have just found a solution to the problem I was having with a google search on how to do this with NGUI. It appears the UIRoot has a Scaling Style option, and I had it set to flexible, which doesn't appear to be what I want for mobile devices.
     
  8. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
    Unless you require it to be pixel perfect, it is often better to change the UI Root scaling style to Constrained so that the UI will scale along with the screen size.
     
  9. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,066
    I'd recommend watching some of the NGUI videos on resolution independence. Those scaling settings on UIRoot are exactly what you want to be tweaking though.
     
  10. drew_s

    drew_s

    Joined:
    Dec 9, 2014
    Posts:
    14
    Cool yeah I did not even realize that until I googled that specifically.

    Thanks SteveJ and DanielQuick for the recommendation. I'll google to find those videos about resolution with NGUI.
     
  11. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,066
    Actually now that I think about it, I think there was a really good, specific video, but most of it was overhauled in the newer versions of NGUI. Anyway, see how you go, but I'm not sure if there's an up-to-date tutorial on that specific topic.