Hi Everyone. I am trying to determine the proper work flow for creating an app that supports graphics for iPad, iPhone4, and all of the 320x480 resolution devices. I know at this point to create multiple versions of my graphics to support various resolutions across the range of devices. No problem there, but how should I approach setting the correct graphics for GUI/gameobjects for the right device?
I am thinking about using AssetBundles (stored locally, no downloading from a server necessary). I would determine the device generation at startup, easy to do, check. Then after knowing the generation I would load one of three AssetBundles: say for example, Graphics_1024x768.unity3d, Graphics_960x640.unity3d, or Graphics_480x320.unity3d. The AssetBundles will contain resolution specific graphics, which is obvious.
Is this the right approach? Once I know which graphics I need loaded I can just load them into the correct gameobjects/gui elements that the game needs. Is there a better way to organize all of the assets I have knowing that I am only going to theoretically need 33.3% of them loaded for a given device. If anyone can comment or add anything that would help me understand this hefty challenge, I would be greatful. Without any other input from the community, I will be trying this workflow and will report back my success to you guys. Thanks a lot.
in 1.7 you cannot determin whether the device is iPhone 4 or not. There is a function to check the device in unity (forgot the name) but that will output unknown on iPhone4.
After rewriting some code of unitys xcode output, you can however get HD output on that to work.
In unity you could than test for Screen.width == 960 and that would be your iPhone 4.
Thanks for the reply. About a week ago I saw your post and was easily able to get your solution up and running. Thanks . I hadn’t really considered doing a screen width/height check though. I was going to use the iPhoneSettings.generation function. I was going to determine if a device was iPhone4 if it was “Unknown”, because I too am using Unity iPhone 1.7. Basically in my code it would look something like this:
pseudo:
if (generation == any of the 480x320 devices)
//we know the device is 480x320 res
else if (generation == iPad)
//we know the device is 1024x768 res
else
//it's unknown, but we can say it's iPhone4 due to process of elimination (or the Unity Editor)
The thing that sucks about the above way is if Apple comes out with another device that provides a different resolution. I’d pretty much be screwed there. That’s why I think I am going to use that screen height check.
Late last night I was thinking of an alternative to my original idea of using AssetBundles. It was about creating each of my scenes multiple times for each target resolution. For example, a title screen, with GUI elements would need to be tailored with graphics that support the various resolutions. So I would make 3 title screen scenes named: TitleScreen_1024x768, TitleScreen_960x640, and TitleScreen_480x320. Based off of knowing the screen height I would only “LoadLevel” where scene name contains the correct height of the device in the string. Each scene would be created with their cameras already supporting the proper sizes, all GUI elements would be positioned exactly how they need to be. This to me seems like it would prevent me from having to go in at runtime and say “hey GUI elements, since you are on a device that’s 480x320, you need to position your elements to these spots, etc”. Meaning I would need to have a script that stores the information of each elements resolution dependent data, for each resolution. The downside of having multiple scenes I’m assuming is more memory taken up in the final size of my app. Is this correct? What do you guys think of these ideas? Thanks again. Back to work.