- Home /
Target Different Resolutions on iOS
Hi All
We are writing a dungeon crawler for iOS with Unity - we're using per-pixel lighting and it's all running fine on 3G S and iPhone 4S at the native res. Not surprisingly, it runs at an unacceptable speed on the latest gen iPod touch and iPhone 4, clearly down to the fact that 4x the pixels is a real killer. We've tried it with very simple diffuse shaders and we're not drawing huge amounts in our recent test - about 15K polys, around 4 or 5 materials, about 25 draw calls - we're static batching maybe 20 calls typically and we are using occlusion culling. We have a few particle effects, but these are using simple shaders and we typically have about 8 particles per emitter, so we didn't ought to be killing the performance and turning these off doesn't appear to make any difference.
In this scenario, I'd clearly like to target the higher res for the 4S, iPad 2 and iPad [3], but go with the lower res on the older devices with the high res screen - I don't especially want to be releasing a HD version and a SD version, although I guess it is an option, but in the case of the HD version, I'd need to ensure it didn't run on older hardware with the higher res.
I've had a play about in the XCode project, as it ought to be possible to make a change there that would target both, but it's not entirely obvious to me where the resolution is being taken from - but before I dive in too deeply, I thought I'd ask if anyone else had solved this problem?
Thanks a lot Bovine
Answer by whydoidoit · Jun 28, 2012 at 10:20 AM
You can do that no problem :) I asked the same question a few days ago and ended up having to work out the answer myself. It's all listed out here. Basically you change the XCode project to detect an iPhone 4 and then change the CreateSurface code - anyway, full code in the link provided.
Thanks!! Looks like exactly what I needed to do!
(how's that serializer co$$anonymous$$g along $$anonymous$$ike?)
Version 0.8 just released. Getting there... Another 3 or 4 weeks to v1
Answer by Mortoc · Jun 26, 2012 at 08:56 PM
You could build twice. Make a build script that makes one build for iPhone 4 at Standard Resolution and one for iPhone 4s at HD. Your build time would increase, but you wouldn't have to support code changes in the generated XCode project (which I assume would be a nightmare to maintain).
Yes, but that would mean releasing a HD version and an SD version - I also read something that suggested Apple have clamped down on that kind of release strategy, but I've not had time to substaniate that view... it's a cheap solution if that happens to be the workflow I follow.
It's not hard actually that hard to maintain the XCode project as it's only a few lines of code. It's also probably possible to create a post build script to do it for you.
The answer below is actually not as bad as I had thought it might be, I'd go with whydoidoit's answer.
Yeah a post build step to fixup the CreateSurface() method sounds good tbh. I'll worry about it a little later though now - It would be useful if resolution could be deter$$anonymous$$ed on a per platform basis...
Your answer
Follow this Question
Related Questions
Duplication of the scenes for different resolutions ? 1 Answer
iOS target resolution does nothing? 0 Answers
iOS hardware limitations. 1 Answer
Random.seed on different hardware? 1 Answer
How to test iPhone's resolution in iPad? 0 Answers