I have a trouble with Unity, game size. Before it was 1024 * 768, but then I decided to try 1680 * 1050 and changed in in the Player Settings (Edit menu item). Then I built my game and it had … 1024 * 768! This was about 4-5 times. Ok, then I set it back to 1024 * 768 in the Player Settings, and now I create a build and it has … right, 1680 * 1050! What’s wrong with Unity? I have removed everything from AppData\Roaming\Unity folder. Where else can it store this info?
I also removed my ProjectSettings folder in the game folder - it didn’t helped, just broke my game.
Guys, no ideas? I believe it doesn’t store its settings in the Library or ProjectSettings folders, because yesterday I had to recreate almost the whole game and I removed both folders. So this stuff should me somewhere else.
So I’m waiting for a unity person’s reply. Should I create a bug report or not. I thought about registry, bug didn’t have time to check that yesterday, will try to do that in the evening.
Frankly, I’m very disappointed with unity It’s a powerful tool to create games, but it has too many disadvantages for such a good software. It’s pity.
I’m pretty sure that the Player Settings are exported into the mainData asset file. I’d propose the suggestion that because thousands of people haven’t replied to your thread saying “yeah, I have that too” the problem isn’t in Unity but in something you or a windows setting is doing. Then again, it could be a bug, so a report into our QA teams is probably the right thing to do. However…
Building angrybots and changing the default window size certainly changes the mainData file (checked using an md5 generator). However, the app starts up in the same window size. If I change the Product Name in the Player Settings the resolution does change. So, my belief is that Windows is “getting in the way”. Sure enough, if I use RegEdit, and look in:
HKCU/Software/{company name}/{product name}
there are keys that store the mode, quality, width and height. So, I think we have learned that these keys override the settings you have made. So, to solve your current problem, either delete the registry keys, or change the product name during development. I imagine for a shipped product you’d want the resolution to persist across runs so the user doesn’t have to keep changing the resolution to their preferred one.
I’m sorry that you are disappointed with Unity. Yes it is powerful. What other disadvantages (other than settings stored in the registry) have you encountered?
Graham, thanks for the answer, will try to look at this registry node in the evening.
I don’t think that storying in the registry is a disadvantage. Disadvantage here is that it isn’t clear. I mean I have some specific fields in the settings, I change them and it doesn’t lead to what I expect. I change resolution but still have the old one. I change it back to the first one, but have a build with the second one. It’s strange at least.
The other disadvantage for me (I used XNA before) is its strange… don’t know how to call it… organization of development. I mean here I have to derive all the classes from MonoBehavior, so I must use only Instantiate method. But I have got used to good constructors, special organization of my game objects. And as example, when I port my old game to Unity, I don’t just port, I have to think a lot how to make it in Unity system.
Maybe it isn’t a disadvantage. Maybe it’s a BIG advantage, but I haven’t understood that, yet. And of course, I don’t want to blame Unity in all the sins, I see it’s a very cool tool, but not ideal. And now I’m a bit too angry, because I had to waste a few hours yesterday restoring my lost scenes and playing with resolution. Many Unity things are still strange for my comparing them with general development or with XNA, that’s the reason.
Well, I have looked at the node Software/Unity Technologies/Unity Editor 4.x, but it doesn’t contain anything like my resolution (1024 * 768 or 1650 * 1080). It contains a lot of parameters, some of them are UnityEditor.BuildPlayerWindowh_h224573012 and UnityEditor.BuildPlayerWindoww_h224573003. Look like what I need, but their value is strange - “(illegal parameter DWORD (32 bits))” and frankly, I’m a bit worried about deleting these parameters. Then I remembered about Product name and changed it and it helped. I created a build and it has exactly that size which is set up in the Player settings. But it doesn’t work if I specify a name which was already specified before. E.g. if I use “name 1” then “name 2” then “name 3” and change resolution - everything is ok, but if I change resolution and set name to “name 1” again - new resolution will not be used. It looks like a bug, will try to report to Unity team.
Anyway, Graham thanks for your help! Will use it for a while.
Maybe I misunderstood something. I think I assumed you had problems with the resolution of the built game. The registry you mentioned are settings for the editor itself. You probably don’t want to mess with those. What is it about the resolution in the editor that is the problem?
If your problem is related to the built executable, then I think you’ll want to delete the registry keys that the previous execution of the exe left behind. At least whilst you are experimenting with the size of the window you want the game to start up with. The thing to realise here is that the executable name has no bearing on the data stored in the registry. It’s the company and product name which are used to access the registry. I’m certain this is not a bug. The code must be doing something like:
a) Start game
b) Look to see if registry has screen resolution set for the application, using company and product names
b1) If registry does have values, use them
b2) else use the values baked into the mainData
c) Let the game play
d) On exit save the screen settings into the registry, again using company and product names
It might be the case that (d) is something that Windows does for all applications - the hive I looked into certainly had a gazillion entries for different applications and I’d be surprised if every single application had to do this for themselves. I guess you want to think what the behaviour should be for the end user. If you want to “hard code” the resolution that the game always starts up in, I guess in a Start() function somewhere you can use the Screen API (Unity - Scripting API: Screen) to set the dimensions.
Yes, that’s what I need! I didn’t understand that at first, but now I know how to fix the problem. I didn’t understand that I should look for the settings in the registry in MY node, I mean company name and product name which I specify in the Player Settings. I have found a few of them, removed and created and run a build again. And it has exactly that resolution which I specify in the Player Settings.
The problem here is that I disable the resolution dialog, so I think this settings should be updated in the registry by Unity when I change them in the Player Settings. Maybe it isn’t a bug, but it isn’t clear to me (an maybe to someone else).