I posted this on Unity answers and didn’t get any answer, so I’m posting it here.
Ok, I just updated to Unity 5, and I’ve been trying to figure this out for long while now. No matter what resolution I set for windows standalone player settings, I get the same 720:480 resolution. I’ve turned off/on the display resolution dialog. looked around in the settings. Nothing. All I get is the default 730:480… I tried to do it through code just to see what happens and it’s completely ignored. I even set full resolution to false and it went fullscreen. All the aspect ratio settings in the player settings are checked. The resolution looks fine in the game preview window, but does not translate into the final build.
Hey there ullman,
I think I may have come across the answer for you a littler earlier after some searching. I really hope it’s a bug and not a feature.
Whenever you build a new game using Unity, it saves a registry key (in windows) or a preference file (On Mac) under the Company Name You selected for the player settings. By default, this is “DefaultCompany”.
The registry key or preference file will still contain old display settings and other settings that are NOT over-written when you hit build, if you are building using the same Company Name. This will lead to Unity using the nearest resolution to what you have selected as a standard resolution supported by the video card.
To fix this, locate the following registry key in windows **- HKCU\Software[company name][product name]**and delete the entire key and rebuild, then run the game. You can access your registy by typing “regedit” (without the quotes) into your windows search, or if you are using Win8 you can hit the windows key and just type “regedit” (without the quotes) and windows will locate it for you.
In Mac, delete the corresponding preferences file located in ~/Library/Preferences/unity
Yes, thanks. I can’t believe this hasn’t been addressed in three years?
I’m creating an app launcher in Unity 5.6 (as 2017 uses libcurl which stops files being accessed from my server).
Deleting the registry key, as mentioned, works like a charm. This is not an intuitive solution and it still presents me with the problem of how to modify this on any clients/launchers I distribute.
This is working for the resolution, but I have a looot of trouble to change the fullscreen mode, honestly it seems to happen at random. I delete the regedit, restart Unity, nothing. Then, after doing this 2 more times for other reasons (fullscreen switch, single instance) it suddenly decides to finally save my changes!
EDIT:
So I found out that the “Fullscreen Mode” Setting is… different than I thought. I think a better name for it would be “Default Screen Mode”. Apparently, the screen mode you select is what the game will open with the first time you play it, where as I though it meant what the executable understood under “fullscreen” (windowed, for example, being a maximized window). After a bit of studying up in the documentation things are starting to get more clear, but it’s still annoying how much of a hassle this seemingly simple issue actually is.
Came across this issue myself today, so I wrote a script that automates deleting the relevant keys.
Simply put the below script in a folder at Assets/Editor and a new menu will popup in the menubar.
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Win32;
using UnityEditor;
using UnityEngine;
public class CleanRegistryKey
{
[MenuItem("Registry/Clean Unity Build registry items")]
static void Clean()
{
string keyPath = String.Format(
"SOFTWARE\\{0}\\{1}",
PlayerSettings.companyName,
PlayerSettings.productName
);
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyPath, true))
{
if (key == null) // Key doesn't exist
{
Debug.LogWarning("Could not find key. Have you built this project at least once?\n"
+ "Key tried: " + keyPath);
return;
}
List<string> screenManagerVals = key.GetValueNames()
.Where(x => x.StartsWith("Screenmanager"))
.ToList();
if (!screenManagerVals.Any())
{
Debug.LogWarning("There were no 'Screenmanager' values in the registry. " +
"Have you cleaned this key before?\n" +
"Key tried: " + keyPath);
return;
}
foreach (string value in screenManagerVals)
{
// These keys all have to do with setting screen size / type.
Debug.Log("Deleting value: " + value);
key.DeleteValue(value);
}
Debug.Log("Successfully deleted the 'Screenmanager' values.");
}
}
}
Alternatively, you can set the screen resolution from your script. When you run the build it will adopt the new resolution which will subsequently become the default build setting.
The third parameter (boolean) disables / enables full screen mode.
[quote="jough, post: 2100981, member: 384609]
To fix this, locate the following registry key in windows - HKCU\Software[company name][product name]
[/quote]