Unity actual combat (8): Set the running output resolution

Table of contents

Preface

method


Preface

This article solves the problem of customizing the resolution of unity output when running

method

After modifying the output and resolution of the following code, mount it on an empty object

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class ActiveDisplay : MonoBehaviour {

    void Awake() {

        for (int i = 0; i < Display.displays.Length; i++) { //There can be multiple outputs, corresponding to multiple displays

            Display.displays[i].Activate();

            Screen.SetResolution(1920, 1080, true); //Change here to the resolution that needs to be output

        }            

    }

}

Guess you like

Origin blog.csdn.net/qq_41904236/article/details/132639143