Determining Running environment

Hey all - this is a bit of a noobish question, but I’m wondering if someone else has already run into this.

We developed our first Unity iPhone game with the game camera rotated 90 degrees from the v1.0 iphone release. Fine for running the game, but it made debugging and editing a chore inside of unity we had to interpret the screens on the fly.

Now that the 1.1 release is pending, I’ve been debating about re-organizing our project to be a bit easier to maintain going forward, but that would trigger a large amount of art-changes - I’d like to avoid that if possible and make the game a bit “smarter” instead. :slight_smile:

I’m wondering if I there is a simple call that the Unity engine can use to determine if its run-time is a Web, iPhone or in-editor client. Any suggestions? We currently address this by un-commenting and commenting out the following line of code - as I’m in the process of testing/debugging our next build I’m finding I have to go back to this line quite often as I go back and forth.

//Main GUI function
function OnGUI ()
{
//comment out for horizontal view
GUIUtility.RotateAroundPivot(90,Vector2(160,160));
GUI.skin = gfgSkin;
Display();
}

Any suggestions are greatly appreciated! :slight_smile:

Application.platform

There aren’t many situations where you’d need to build a game with a rotated camera. Why didn’t you use “iPhoneSettings.verticalOrientation = true”?

Ah! So obvious! Much appreciated!

I believe we started in that route on an early iPhone build and ended up with that solution as our game’s was in a wide-screen format and we resolved it with rotating the camera. (We also were very new to Unity). If I had to do it over again we’d do it quite a bit differently.

Thanks so much!