0
\$\begingroup\$

I am making a TV remote app for a specific android device (the Pixel XL, 1440x2560 resolution). However, when I put the app on my phone, it truncates most of the app.

Here's what it should look like: The app is in full view.

Here's what it ends up looking like: The app appears zoomed in.

My game is forced in portrait, and I want to keep it that way. I have tried rotating the canvas, but that does nothing. The Android app also seems to ignore the main camera; I think it is just using the canvas.

I tried many different things, including changing the scaling and setting the anchors. None of this had any effect. I have even set the editor Game window to the target resolution, but it appears to work via the editor.

Why is Unity ignoring my camera on Android?

\$\endgroup\$
3
  • \$\begingroup\$ Forcing landscape cuts off much less, but I want it in portrait. I've also tried rotating everything, but it has the same effect. \$\endgroup\$
    – user100539
    Commented Apr 30, 2017 at 23:33
  • \$\begingroup\$ Yeah, I'm aware of this (really the only thing I am aware of), and I've tried this and it works in the render (somewhat). \$\endgroup\$
    – user100539
    Commented May 3, 2017 at 3:59
  • \$\begingroup\$ I just deleted the main camera and re-added it. It now is displaying nothing. Know why this might be happening? \$\endgroup\$
    – user100539
    Commented May 3, 2017 at 4:02

2 Answers 2

1
\$\begingroup\$

It is truncating; actually, your UI is not responding to the resolution of your device. You have to set its anchoring and scaling. I would recommend you read the Unity guide for "Designing UI for Multiple Resolutions"

For a reference, this what you have to change:

In the Canvas Scaler component, you can set its UI Scale Mode to Scale With Screen Size. With this scale mode you can specify a resolution to use as reference.

...

When the screen size is changed to a larger or smaller resolution, the buttons will also remain anchored to their respective corners. However, since they keep their original size as specified in pixels, they may take up a larger or smaller proportion of the screen. This may or may not be desirable, depending on how you would like your layout to behave on screens of different resolutions.

\$\endgroup\$
13
  • \$\begingroup\$ Okay, the resolution is set to the exact resolution of the phone, and it's still doing this. As someone already suggested, I'll try the anchors tonight when I have access to my app \$\endgroup\$
    – user100539
    Commented May 2, 2017 at 14:04
  • \$\begingroup\$ Setting the anchors had no effect. \$\endgroup\$
    – user100539
    Commented May 3, 2017 at 3:23
  • \$\begingroup\$ post some more information in the question.with snapshot of your UI with canvas \$\endgroup\$ Commented May 3, 2017 at 4:27
  • \$\begingroup\$ What information exactly? \$\endgroup\$
    – user100539
    Commented May 3, 2017 at 4:49
  • \$\begingroup\$ as i told you before select you canvas and make screen shot of your canvas in scene view \$\endgroup\$ Commented May 3, 2017 at 5:12
0
\$\begingroup\$

There's so many possibilities for your problem. Basically, you can try these and if it will not work then you should to give more information about your scripts components etc.

Check your Canvas' UI Scale Mode, it should be Scale With Screen Size

If it is then check your sprite what's look like in the Inspector. Attention to Pixel Per Unit factors.

If everything is okay then check the Canvas-UI element's anchor. And see the spread of UI elements (like buttons) in the screen.

Did not works ? Give us to more info and let's write a camera script.

\$\endgroup\$
8
  • \$\begingroup\$ The UI Scale Mode is "World" and grayed out. \$\endgroup\$
    – user100539
    Commented May 1, 2017 at 0:08
  • \$\begingroup\$ I tried changing Render Mode to "Screen Space - Overlay" and "Screen Space - Camera", and UI Scale Mode was set to "Scale With Screen Size", which didn't work on either. \$\endgroup\$
    – user100539
    Commented May 1, 2017 at 0:14
  • \$\begingroup\$ Not quite sure what you mean by Pixel Per Unit, the Reference Pixels Per Unit for the canvas (under inspector) is 100. \$\endgroup\$
    – user100539
    Commented May 1, 2017 at 0:30
  • \$\begingroup\$ Hmm, I think your problem with the anchors. Add a new button into your Canvas. (Example) Click the Anchor Presets and Click Right. The button will not leave the right edge anymore. You should try to find best with move the anchor presets. \$\endgroup\$ Commented May 1, 2017 at 0:46
  • \$\begingroup\$ I'm not quite sure what you mean, I created a new button and found the Anchor Presets. I clicked right, and it appears to snap to the top of the image (or the right of the remote, on the side with the 3, 6, and 9 keys). It snaps with a blue line, but I'm not quite sure what you want me to do from here. I'm having trouble understanding what "You should try to find best with move the anchor presets." means. \$\endgroup\$
    – user100539
    Commented May 1, 2017 at 2:09

You must log in to answer this question.