Is there a setting to default the Editor Game View to a specific aspect ratio?

I am trying to get the game view fixed to portrait mode. While this of course works on my computer, I can’t find a way to set this for colleagues so that other people who access the repository will automatically see the game in portrait mode as well.

I looked further into it and I found this link that might help you: Add and Select Game View Resolution Programatically - Questions & Answers - Unity Discussions

I also tried to work out a simpler solution, that does not require actual Editor scripts. This solution grew quite big, since it needs a lot of commentary because it is not so straight forward what is happening under the hood. I attached my script below.

What my script essentially does is, it looks for the current aspect ratio of the game view, and if it is not set to 9:16, a Debug Message informs the programmer that they have to set the game view to 9:16.

It seems that Unity has some rounding issues when it comes to calculating the aspect ratio of the game view. So instead of checking if the current ratio is exactly 9:16 (=0.5625), I rather check if it is close to that number.

I can imagine that Unity returns different results on different computers, that’s why I also added a debug mode, that allows to see what ratio Unity finds on your machine.
I hope that my code or the link delivers a valid solution for you.

using System.Collections.Generic;
using UnityEngine;
using System.Linq;

// Description:
// Attach this script to a GameObject in your Project
// This script will ensure that the game view window is always set to an aspect ratio of 9:16
// It checks the current aspect ratio and informs the programmer with a debug message if the aspect ratio is not set to 9:16
// Summary:
// When the game view ratio is set to 9:16, it is expected that the calculation '(float)Screen.width / (float)Screen.height' returns 9:16 = 0.5625
// This is not always the case (I am unsure why). 
// When you set your game view ratio to 9:16 and you squeeze the view horizontally (left/right), to the point that Unity draws letter boxes (gray bars
// on top and bottom to maintain a ratio of 9:16), then the calculation returns values that are close to 0.5625, but not exact.
// In my tests it returns values between 0.5611111 and 0.5638298
// That is why I check for a ratio range in Update(), instead of just looking for (float)Screen.width / (float)Screen.height == 9f/16f
// If you want to find out what values your Editor returns for (float)Screen.width / (float)Screen.height, first set your game view window to 9:16.
// Enable the debugMode bool in the inspector and play around with the width of your game view 
// Slowly stretch the windows enough so that Unity draws Pillar boxes (gray bars left and right), and squeeze it enough to force Unity to draw letter boxes 
// (gray bars on top and bottom)
// After you have done this, rightclick on the script in the inspector and select "Print MinMax" to print the smallest and biggest ratio that Unity detected
// Use these numbers to set your min max values in the if-statment.
// For me that is 0.5611111 and 0.5638298
// So to make sure I dont trigger that if-statmen accidentally, I set my range from 0.560 to 0.564

public class AspectRatioChecker : MonoBehaviour
    [Tooltip("Debug Mode: Use this to determent a better ratio range for your game view (Read Summary inside this script for more information).")]
    [SerializeField] private bool debugMode = false;

    private List<float> ratios = new List<float>();

    private void Update()
        // Only do this in Editor and while not in Playmode
        if (Application.isPlaying) return;

        Debug.Log("Is Running!");

        float ratio = (float)Screen.width / (float)Screen.height;

        // Check if Aspect ratio is 9:16 (or very close to it)
        if (0.560 <= ratio 
            && ratio <= 0.564)
            // We are in desired Range (very close to 9:16)
            // Not in desired Range
            Debug.Log($"Wrong aspect ratio deteced. Please set the aspect ratio of the game view to 9:16");

        // Debug Mode
        if (debugMode)
            // To prevent the list from growing too big
            if (ratios.Count < 1000)
                Debug.Log($"Ratio: {ratio} " + '

’ +
"List length: {ratios.Count}/1.000"); } else { Debug.Log(“Ratio List already holds 1000 values. Please clear the List or disable DebugMode.”);

    [ContextMenu("Print MinMax")]
    private void PrintMinMax()
        Debug.Log($"##### Elements in List: {ratios.Count} #####");
        Debug.Log($"Min: {ratios.AsQueryable().Min()}");
        Debug.Log($"Max: {ratios.AsQueryable().Max()}");

    [ContextMenu("Empty List")]
    private void EmptyList()
        Debug.Log($"List cleared!");

In Game-View one centimeter below there is the word “Display 1”. Right of that there is the word “Free Aspect”. Click on it and select Aspect Ratio