Is it possible to call Screen.SetResolution at startup?

When I try to call Screen.SetResolution() from either Start or Awake I’m getting some crazy display errors (or my machine freezes).

I am building for standalone on Mac (Snow Leopard).

Our game is getting rejected from the App Store because when the maximum resolution is chosen from the resolution dialog, the dock interferes with the game window.

We are trying to devise a solution that involves setting the resolution at startup, but are having some problems doing so.

We’ve already tried a couple approaches:

  1. Make the game start at 80% of the monitor’s maximum resolution
  2. Choose one of three pre-determined resolutions at startup based on user’s monitor size
  3. Make the game window slightly smaller if it is too close to the maximum resolution at startup

Unfortunately, all of these approaches involve manipulating the display resolution at startup. When we try to do this we either get a frozen computer or a game window full of nonsense.

Is it possible to call Screen.SetResolution at startup?

If not, does anybody have any thoughts on the best way to approach this?

Hey,

I`am using

Screen.SetResolution(1024, 768, false) 

and this is working on both Mac & PC with no problem, but I found out when a ScreenCaptureSoftware like Fraps is running bevor I start the game, it is freezing or producing an error on Unity side.

I also tested this on a various range of Machines. XP, Vista, Win7, Mac SnowLeopard and on older PPC Mac´s with Tiger OS.

So I think the answer is yes, it is possible.

For point 1 & 2 you could create a var in PlayerPrefs for width and height, then using Screen.currentResolution.width(same for height) pass it to the PlayerPrefs var and then check them in an If statement like “if playerprefs.width is bigger than 1024 choose resolution xyz”

Please take a loot at this post.
I posted a code that changes the resolution of the app that works fine in PC plataform.

http://forum.unity3d.com/threads/85157-change-game-s-resolution?p=1077840#post1077840

Hope it helps =)