Search Unity

Fit screen unity remote vs apk

Discussion in 'Scripting' started by Rotzak, Aug 2, 2018.

  1. Rotzak

    Rotzak

    Joined:
    Jul 11, 2018
    Posts:
    92
    Hello,

    I have an issue with fitting my app on my phone screen as apk. See the pictures below. You can clearly see that the bush is fully shown on the unity remote app. Also you can see that there is a part missing of the bush as apk.

    Unity remote picture:

    Apk picture:


    How can I fix this? I have the same issue with clamping a value between let's say -2 and 2, it isn't the same on remote as apk.

    In the past I found this script, which I attached to the main camera, but it doesn't seem to do anything:

    Code (CSharp):
    1. public class FitScreen : MonoBehaviour {
    2.  
    3.     // Use this for initialization
    4.     void Start () {
    5.         transform.localScale = new Vector3(Camera.main.orthographicSize * 2.0f * Screen.width / Screen.height, Camera.main.orthographicSize * 2.0f, 0.1f);
    6.     }
    7.    
    Help is much appreciated.
     
  2. Rotzak

    Rotzak

    Joined:
    Jul 11, 2018
    Posts:
    92
    Still can't find it...

    btw I'm using a canvas scaler for my game over page --> scale with screen size
    My background is on a quad

    Should I be looking in the player settings since the problem occurs as apk?
     
    Last edited: Aug 3, 2018
  3. Rotzak

    Rotzak

    Joined:
    Jul 11, 2018
    Posts:
    92
    bump
     
  4. diegoossal

    diegoossal

    Unity Technologies

    Joined:
    May 10, 2018
    Posts:
    4
    Hi @Rotzak

    First of all, the Quad that you are using as a Background does not have an appropriate size for 16:9 Screens.
    To have a better idea of what you will see on your phone, you should create an aspect ratio according to the device you are targeting.

    After that, in the Scene view, you will see a square that tells you what you will see on your screen.

    For this reason, you could use the
    FitScreen
    script. (Attaching it to the Quad, not to the Camera)
    It would be better if you create a background according to your target device, to avoid stretching the texture.

    Good luck with that!
     

    Attached Files:

    Rotzak likes this.