Okay some starting info. This app I’m working on is for iPhone 3G and newer (supports) retina display. It is not supporting iPad. I have a very simple game with about 6 scenes and a couple of textures per scene (card match game). I am using the following script to basically detect the device resolution and load the appropriate scene for the device. Problem is when I run it on my 3GS or in the editor at standard res it still loads the HD scenes. I have poured and poured over forums on how to solve this and came up with nothing to fix this script. I know there are other methods, but I am so close to finishing this project I would like to repair this method.
#pragma strict
//this is the script that will determine what device the app is running on
//and load the specific scene files per device.
function Running960()
{
return Screen.height==960;
return Screen.width==640;
//so it works in the editor
}
function Running480(){
return Screen.height==480;
return Screen.width==320;
}
// if this detects retina resolution to load the 2x scene files and assets
if (Running960)
{
Application.LoadLevel ("MainMenu2x");
}
// if this detects standard resolution to load the regular scene files and assets
else if (Running480)
{
Application.LoadLevel ("MainMenu");
}
@colargol - that was the exact problem. I have no idea how I could be so blind to not see that! You have saved me so much time and countless headaches figuring this out. I really don’t know how to repay you sir!
Hi guys
Reading the above with interest, that your loading a scene that is set up for either 3GS or Retina, rather than swapping/loading out textures within the scene. I was thinking of doing the same as it seemed the most logical thing to do (and easiest).
My question is, if both scenes contain exactly the same scripts, does the final build include a double up of all scripts (as they’re in 2 scenes), or just one? (Just thinking of memory here). Sorry if this is a noob question!
I don’t think this is the most efficient method either, I am pretty sure it stores both copies. Luckily my game is very tiny and consists of about 5 scenes with barely any geometry in them so I don’t take a huge hit in the app size.
My game is only small as well, but i have a lot of scripts in the game scene, hence my concerns.
I’m using SpriteManager2 for my entire game. The problem i find is that if i bring in Retina textures, i have to change the ortho camera size to 340 (i’ve the vert of the screen res), and this then throws out all of the scripts and scene game object’s transform.positions etc…
Yeah the solution I’m using I had entirely different scenes for the HD version, so the camera could have entirely different settings and not affect my SD version. I’m using all 3d objects too, so they scale up and down at the same aspect ratio fine. I don’t use too many scripts myself, so I don’t know how that will impact you.