Android device-specific resolution

Asked 1 years ago, Updated 1 years ago, 43 views

I played it on Android with Unity Remote 4, but the screen was long.
It is vertically long on Android.At that time, the screen will be reduced in width and the resolution will decrease. Does this mean that it is preferable to adjust while playing the actual machine?
Also, the resolution and API? vary depending on the Android device, so how to match each device
Do you have any?

Also, to make images like larger (769x1000) appear smaller without losing resolution
Do I need to move the camera?

android c# unity3d

2022-09-30 16:57

2 Answers

Unity Remote 4 transfers the GameView screen to the terminal.Therefore, if you transfer the horizontal screen to the vertical terminal, the terminal becomes vertical.Therefore, if you want to play the horizontal screen in Unity Remote, you need to turn the terminal to make it horizontal.
Basically, the resolution of GameView is extended, so if you want to check the layout, I think GameView should be the same as the layout of the terminal (aspect ratio, not resolution), or transfer it to the terminal.


2022-09-30 16:57

I have my own script for changing the resolution to a certain percentage (50% of the width) of the Button if the UI Button is on the screen.

ScreenSizeKeeper.cs

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class ScreenSizeKeeper:MonoBehavior {

    public Button myButton;//set UI>Button which width is used as standard

    bool isRunningOnAndroid(){
        return(Application.platform==RuntimePlatform.Android);
    }

    void Start() {
        if(isRunningOnAndroid()==false){
            return;
        }
        float aspect=(float)Screen.height/(float)Screen.width;
        float buttonRatio=0.5f;//50%
        int buttonWidth=(int) myButton.GetComponent<RectTransform>().rect.width;
        float newWidth, newHeight;

        newWidth = buttonWidth/buttonRatio;
        newHeight = newWidth* expect;

        Screen.SetResolution(int) newWidth, (int) newHeight, false);
    }   
}

The above script is associated with an Empty GameObject (name: ScreenSizeKeeper) to adjust the screen resolution.

Switching between Vertical and Horizontal is not considered.


2022-09-30 16:57

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.