Search Unity

iPhone6/6+ and iOS8/Xcode6 first hand on experience with Unity

Discussion in 'iOS and tvOS' started by David-Berger, Sep 19, 2014.

  1. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    745
    I wanted to share a first hands on experience with you on how to build apps for iPhone6/6+ with Unity 4.5.4. :cool:
    In general it can be seen as update guide to get your apps made with Unity onto the iPhone6/6+ or other iOS8 devices using Unity 4.5.4p1 on a Mac 10.9.5.

    IMG_0433.jpg

    Requirements:
    • Development Mac
    • Activated iOS Device
    • Unity 4.5.4p1
    • Itunes 11.4
    • Xcode 6.0.1
    • Command Line Tools 6.0

    Setup device for development
    If you have not setup your iPhone6/6+ already, keep in mind you need an active sim card to activate the phone. Enabling your iOS device for development mode is not necessary anymore in the new Xcode.
    You still have to add your phone to the development profiles! A short form on how to do that, can be found below[*].

    Download Unity Update
    Unity 4.5.4p1 - adds support for Xcode 6 and iPhone6/6+. Build can be downloaded at here.

    Download Xcode, iTunes, Command Line tools
    If you use iTunes 11.4, Xcode 5.1.1 or below and Command Line Tools 5.1 or below, you will need to upgrade to the latest version. Your Mac Software Update will already suggest you to update different updates. Xcode 6.0.1 and the Command Line Tools 6.0 need to be installed. Keep in mind, that you will be required to enter the Mac root password and accept new Terms & Conditions. Furthermore, your mac will be restarting during the installations.

    Note: If you have not installed Xcode yet, you can download it for free in the App Store. If you installed Xcode for the first time you will have to download the Command Line tools too.

    Go to Xcode -> Preferences->Downloads and install Command Line tools

    Build and Deploy the game
    Now you should be ready to go!
    1. Start Unity Engine 4.5.4p1
    2. Load
      • Angry Bots
      • new empty project
      • your app
    3. Switch platform to iPhone in Build Settings
    4. Build And Run
    That's it, feel free to ask any questions if you encounter problems during upgrade. :eek:
    It's weekend, might take a while until you get a response from me, but anyone is welcome to answer (as always)!

    [*] Howto get iOS Developer Certificates
    A good guide can be found here on the apple developer site. This is just a small howto used as quickstart.
    1. Attach your iOS device to Mac
    2. Join the iOS developer programs.
    3. On your Mac open Keychain Access application
      1. Navigate in menu to Keychain Access -> Certificate Assistant -> Request a Certificate From...
      2. In Certificate Assistant dialog choose Save to disk and click continue and save
    4. Login into http://developer.apple.com/ios
      1. On the right side of the page choose "Certificates, Identifiers & Profiles"
      2. On the new page click Certificates
      3. On Certificates page top right click "+" button
      4. Upload your signing certificate request you made at the point 3.a
      5. Click Generate and download new certificate, double click on the downloaded file installs the certificate.
    5. Open Xcode Organizer window (Window -> Organizer)
    6. Right click on device and choose "Add to development portal"
    7. Login with your credentials you used to join the iOS dev program
    8. Go back to browser window you used for certificate generation:
      1. Now go to Provisioning profiles section in browser
      2. On Provisioning profiles page click "+" button
      3. Choose "iOS Development" provisioning
      4. For App ID choose any useful ;) Click continue
      5. Select all certificates; Click continue
      6. Select all devices; Click continue
      7. Enter some meaningful name like "MyAllDevices" :) Click generate
      8. Download generated provisioning and double click downloaded file to install it in Xcode
    9. Now you are ready to deploy your apps to iOS device.

    Edit: 13.01.2015

    IPA Sizes
    To get the minimal .ipa Size of Unity Apps:
    1. Go to the iOS Player Settings set Stripping Level to Use micro mscorlib.
    2. Build the project. Tested with Unity 4.5.4 and Unity 4.6.1p3.
    3. Open the XCode project
    4. Archive rather than build the project
    5. Go to Window->Organizer into the Archives tab and press estimate size.
    This will result in 12.4MB estimated (14.1MB real) .ipa size in Unity 4.5.4 and before. It results in 16.4MB estimated (17.2MB in real) .ipa size in 4.5.4p1 and above due to:

    Additional files added:
    Bigger files:
    • The executable - 600KB
    • sharedassets0.assets - 4KB
    • unity_builtin_extra - 6KB
    • mscorlib.dll - 2KB
    • UnityEngine.dll - 25KB
    Sum up:
    new images: 2456KB
    new files: 112KB
    bigger files: 637KB

    total of 3205 KB more space used.

    FYI: dSYM are bigger now too ~5MB
     
    Last edited: Jan 13, 2015
  2. F.Salka

    F.Salka

    Joined:
    Dec 13, 2013
    Posts:
    43
    Hi David,

    Will the update solve the render scaling issues on the iPhone 6+ ? currently it seems that Unity apps render at 720p and then they scale up to the full 1080p resolution, which makes everything looks pixelated, i don't have an iPhone 6+ available for development so i can't test it out.

    Thanks in advance!
     
    Last edited: Sep 19, 2014
  3. VIC20

    VIC20

    Joined:
    Jan 19, 2008
    Posts:
    2,688
    Will we get aspect ratio or resolution in the editor game view for the iPhone 6 and iPhone 6 Plus in 4.6?

    BTW: I had an issue with 4.5.1p4. For no reason Unity was opened twice and I was forced to shutdown the hard way (power button)
     
  4. Smilediver

    Smilediver

    Joined:
    May 5, 2011
    Posts:
    72
    Yes. iOS looks for correct sized iPhone 6+ splash screen (or splash screen .xib file) to see if your app supports higher res. We have added support to set iPhone 6+ splash screen in player settings.

    We had a short discussion internally, and decided to skip it for now - we don't want to clutter the menu as it's getting unwieldy large. But you can easily add those entries yourself: just click on the menu and select "+" sign. Aspect ratios of both devices are 16:9 and resolutions of 1334x750 and 1920x1080.
     
    AalokParikh and David-Berger like this.
  5. VIC20

    VIC20

    Joined:
    Jan 19, 2008
    Posts:
    2,688
    Actually it is 2208 x 1242 which will be downscaled to 1920x1080 - just make a screenshot on the device.

    http://forum.unity3d.com/threads/iphone-6-plus-screen-width.269264/

    E
    DIT: I was wrong. According to Apple it should be really 1920x1080 when rendering 3D content in fullscreen mode. (Metal and OpenGL ES)
     
    Last edited: Sep 23, 2014
  6. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    745
    AalokParikh likes this.
  7. stephensa

    stephensa

    Joined:
    Jan 8, 2013
    Posts:
    1
    Has anyone noticed a major increase in app size after upgrading to Xcode 6?

    I'm finding that our app, which is just under 100MB Xcode 5, has an "estimated app store size" of 157MB in Xcode 6.

    I haven't actually submitted it because it wants me to revoke and regenerate my signing certificates, which I don't want to do as I am planning to submit my next update with Xcode 5. So until then I don't have an actual IPA I can dig into to see what has changed. The archive before submission is still roughly the same size.

    This is pretty worrying though as staying under 100MB is important, and I'm not sure how I'm going to claw back a sudden unexplained 50MB increase.
     
    AalokParikh likes this.
  8. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    442
    I noticed our estimated app size went up huge too, but when I actually export the IPA, its not that size, so I am not sure if that estimate feature is broken. I hope so =)
     
    AalokParikh likes this.
  9. Moonjump

    Moonjump

    Joined:
    Apr 15, 2010
    Posts:
    2,572
    Estimate size is how big it is expected to be on the App Store. That has always been different to the ipa size.
     
  10. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,789
    I believe in XCode 6 the estimated size changed to how big the app will be when installed. I had a similar increase of +50% in the estimated size between XCode 5 and 6.
     
  11. F.Salka

    F.Salka

    Joined:
    Dec 13, 2013
    Posts:
    43
    Hi,

    There is a bug with this release, "Disable Audio" in audio settings has no effect, unity seems to still mess with the AVAudioSession when it launches, that was not the case in Unity 4.3, it used to leave the iOS core audio session category intact if you check "Disable Audio" in project settings, i need that since i'm using a native audio plug in instead of the Fmod audio.

    If this bug won't be fixed anytime soon, Will i be able to add iPhone 6+ support manually if i upgrade to Xcode 6 and add the required screenshots in the .xib file (while still using Unity4.3)?
     
  12. Sampora

    Sampora

    Joined:
    May 28, 2013
    Posts:
    2
    Has anyone had a chance to test which of the splash screens does the iPhone 6+ select in a build made with Unity 4.5.4f1 ?
     
  13. qoobit

    qoobit

    Joined:
    Aug 19, 2014
    Posts:
    51
    Hi guys, I recently submitted a project that had to support all the splash screens including iPhone6 and iPhone6+. With the current build 4.5.4p1, the new iPhone6 iOS8 splash screens are bundled but never referenced to in the SplashScreen.mm generated in the xCode project from Unity. I have modified the SplashScreen.mm to reference the proper new splash screen files (namely, the @3x for 667 and 736). It also includes a fix for iPhone6+ since it can have both a portrait and a landscape splash screen which seems to be only available for the iPad as well. I hope it helps others and can get rolled into a future build.

    Note: It isn't exactly the cleanest or most streamlined implementation. It uses certain flags to rebuild the image name string for all the extraneous cases.
     

    Attached Files:

    AalokParikh and David-Berger like this.
  14. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    745
    @Sampora if you update to Unity 4.5.4p2 and use the fix of qoobit it should be correct.
    Thank you @qoobit. That's a pretty nice fix!
    @F.Salka please report a reproducable bug report if possible.
     
  15. ratmat2002

    ratmat2002

    Joined:
    Jun 13, 2014
    Posts:
    35
    Are Qoobit's fix (or an equivalent) inlcuded in Unity 4.5.4p3? We're still seeing the same issue with iPhone 6/6+ splash screens being incorrect with p3.

    If not in p3, when will these fixes be integrated into an official patch release?
     
  16. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    iPhone6/6+ fixes are expected to be part of next week patch release.
     
    David-Berger likes this.
  17. marcdes

    marcdes

    Joined:
    Oct 16, 2013
    Posts:
    4
    will this patch work with unity_update-4.6.0b17 ? it would be great if we could have those fixes plus the new UI.
     
  18. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    745
    No, patch releases are not synced with beta releases. But when 4.5.5 (official release) is released, it will go to the next beta release which comes after the 4.5.5 release. But most of the fixes will be released with 4.5.5p1 (patch release) which means that they go to beta after 4.5.6 (official release) was released which will take another month probably. More information on 4.6 beta releases can be found here.
     
    Last edited: Oct 10, 2014
  19. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    745
    The new patch 4.5.5p1 is live, which brings a lot of fixes for iPhone6(+) and iOS 8!
     
    impe83 likes this.
  20. Corbeil

    Corbeil

    Joined:
    Aug 26, 2014
    Posts:
    3
    Hi David,

    Code (ObjectiveC):
    1. if (scale > 1.0f)
    2.     szSuffix = "@2x";
    3. else if (scale > 2.0f)
    4.     szSuffix = "@3x";
    The @3x Scale will never get executed in the SplashScreen fix that was submitted last week.

    Also, can we look at options for future updates? Maybe take the best fitting resolution? Or find a way to get which ever splash screen was loaded by iOS?

    Cheers,
    ~C
     
    David-Berger likes this.
  21. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    745
    :eek: Bug!

    Thank you! Will be fixed soon! :cool:
     
  22. F.Salka

    F.Salka

    Joined:
    Dec 13, 2013
    Posts:
    43
    This is really unaceeptable. How many patches there will be before you can actually fix these issues? (There have been more than 3 patches - updates so far).

    Updating unity with patch releases is a nightmare now. With each update we have to rebuild the entire Xcode from the scratch since unity can't append existing xcode projects built with a slightly older patch. This can be extremly frustrating since 50% of our project was coded nativly in Xcode and the process of rebuilding the entire project each small patch becomes very time consuming. We have been holding the release for more than 2 weeks waiting for these bugs - fixes to be sorted out.

    I see another patch (4.5.5p2) released on 23 October. Does this patch include a fix for the @3x splash screen or we still need another patch?

    Thanks!
     
  23. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    745
    This depends on how fast a bug, listed in the issue tracker, is reproduced by QA and fixed by a developer. This bug was not raised in the issue tracker so it is difficult to fix a bug if it is not know. But I could reproduce the bug and forwarded it to a developer already, so the bugfix should be available soon. But you can resolve the problem in your source code too so there is not need to wait for a patch release though. There is a patch release nearly every week, but the fixes need to be verified first which can take a while if it could not be verified. 4.5.5p2 does not include a fix for this bug. Patch releases are primary available for Unity users who are effected by a specific bug which is solved in the patch release, you can find the list of bugs and the fixes in the release notes. If you are not affected by any of them you probably don't want to install the patch-release.
     
  24. Jethro

    Jethro

    Joined:
    Aug 23, 2011
    Posts:
    30
    I don't own an iPhone 6 or 6+, but we've updated our app with Xcode 6.0.1 using the IOS 8 SDK to take advantage of the new screen real estate, Also app previews etc, with this submission. Since day 1 our app is designed to work on any screen size and dpi, for easy porting to android etc. First observation, Publishing out to our IPad 2 the app size on the device is about 60MB larger! went from about 400MB to 460MB, from Xcode 5.1.1 to Xcode 6.0.1
    We just submitted this app and the estimated size on store is 378MB, 110MB larger than previous submission. Like another user has stated this is size on device now, but my installed on device test is about 80MB larger than this estimate.
    Also if you create an ipa and export it, it comes in at only 277 MB v 467 installed. (I know Ipa compressed.) This is in line with previous version estimates.
    When you check the size of the Unity Exported Xcode Project and data, they are almost identical. (Unity 4.3.4 v Unity 4.5.5) So unity has caused no inflation.
    Xcode 6 / IOS 8 SDK has caused this inflation! We published for armv7 only. (so no extra 64 bit stuff) However apple flagged a warning that in 2015 all submissions must support 64 bit, so weather its being included to get users used to the extra space usage? I know madness, but just a thought. And why would code take up so much room!

    Our app is The Lost Diamonds and is only 225 Mb on Android. Currently 267MB on the app store (larger mp4s on iOS, due to android video storage issues we had) will be interesting to know what the new size is after approval, on iOS store.

    We tried to use UnityV4.5.5p3, but it broke our Android version, on one of our test devices however it looks like I need at least p2 for iPhone 6? Maybe I need to reject this version, and start over testing with a new patch release.
    Just noticed V4.5.5p4 released, what does it mean by the following.
    iOS: Added support for iPad Mini 3 and iPad Air.
    TLD has run on iPad air since may when first released.
    Be more specific please with these descriptions, to know if we are affected.

    what a nightmare!
    Edit: Just rejected my app, its obvious 4.5.5 has too many issues with IPhone 6, now, "pick a patch any patch" said the card shark!

    Any Ideas Anyone, on the app size issues? ? ? ? ?
     
    Last edited: Nov 11, 2014
  25. Jethro

    Jethro

    Joined:
    Aug 23, 2011
    Posts:
    30
    I'll answer myself, about the app size issue. Note this is not estimated store size this is actually on my device. Basically the version on my device was built with unity 4.5.5 and Xcode 5.1.1 after building and pushing to device with Xcode 6, it did grow by about 60 MB.
    If I delete the app off my device and do a fresh install with Xcode 601, it comes back down to normal size, The 60 mb extra is actually pretty close to my RAW (Streaming Assets) Folder?

    So I tried to reproduce building with Xcode 5.1.1 then Upgrading the app using Xcode 6.0.1 using unity 4.5.5p4
    but it gave me a normal app size ? ? ? The original sequence of events were probably different, ie. The Unity version used to build Xcode 5.1.1 version was 4.5.5 . Anyway I've wasted enough time on this now, I need to move forward.

    I hope users don't end up with inflated upgrades, which is what I had before deleting from my device and installing fresh. Users usually don't delete before upgrade, especially when they may lose many hours of gameplay and have to start over.

    One positive from all this the 4.5.5p4 fixed the Android (Acer Iconia A500 problem, Tegra 2 I believe) that p3 Broke, so I might just use this version to push another Android update as it fixes a lot of new Androids as well.
     
  26. Quaker_SDR

    Quaker_SDR

    Joined:
    Jun 21, 2013
    Posts:
    39
    I have updated to unity 4.6 and i took a build in iphone 6+ i got the same double splash screen problem again, Did anyone noticed? Unity havnt updated this bug in 4.6 release, They have already done that in unity 4.5.5 patch.
     
  27. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    745
    If the bug was resolved in a 4.5.5p patch-release the fixes are not included in 4.6.0. Those changes will be released in the first patch 4.6.0p1 pretty soon.
     
  28. Corbeil

    Corbeil

    Joined:
    Aug 26, 2014
    Posts:
    3
    Hi David,

    While I understand it's not always possible to properly leverage the Xcode editor within Unity (for instance, the Asset Catalog), would it be possible to remove all resolution-specific dependencies within the SplashScreen.mm file ?

    An example:

    Code (CSharp):
    1. - (void)updateOrientation:(ScreenOrientation)orient
    2. {
    3.     NSArray* allPngImageNames = [[NSBundle mainBundle] pathsForResourcesOfType:@"png" inDirectory:nil];
    4.     NSString* imageName = nil;
    5.    
    6.     for (NSString* imgName in allPngImageNames)
    7.     {
    8.         // Find launch images
    9.         if ([imgName containsString:@"LaunchImage"])
    10.         {
    11.             UIImage* img = [UIImage imageNamed:imgName];
    12.             // Has image same scale and dimensions as our current device's screen?
    13.             if (img.scale == [UIScreen mainScreen].scale && CGSizeEqualToSize(img.size, [UIScreen mainScreen].bounds.size))
    14.             {
    15.                 imageName = imgName;
    16.                 break;
    17.             }
    18.         }
    19.     }
    20.    
    21.     if (imageName)
    22.     {
    23.         [self unloadImage];
    24.         self.image = [[UIImage imageNamed:imageName] retain];
    25.     }
    26.  
    27.     splashImageOrient = orient;
    28. }
    Reference: http://stackoverflow.com/a/26425005

    This way, we can manually support new iOS resolutions within Xcode (from the Asset Catalog) and the Unity SplashScreen will support it as well.

    Cheers,
    ~C
     
  29. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    745
    I edited the first post to add information about the empty project size:

    IPA Sizes
    To get the minimal .ipa Size of Unity Apps:
    1. Go to the iOS Player Settings set Stripping Level to Use micro mscorlib.
    2. Build the project. Tested with Unity 4.5.4 and Unity 4.6.1p3.
    3. Open the XCode project
    4. Archive rather than build the project
    5. Go to Window->Organizer into the Archives tab and press estimate size.
    This will result in 12.4MB estimated (14.1MB real) .ipa size in Unity 4.5.4 and before. It results in 16.4MB estimated (17.2MB in real) .ipa size in 4.5.4p1 and above due to:

    Additional files added:
    Bigger files:

    • The executable - 600KB
    • sharedassets0.assets - 4KB
    • unity_builtin_extra - 6KB
    • mscorlib.dll - 2KB
    • UnityEngine.dll - 25KB
    Sum up:
    new images: 2456KB
    new files: 112KB
    bigger files: 637KB

    total of 3205 KB additional data in newer versions.

    FYI: dSYM are bigger now too ~5MB

    @Corbeil I forwarded the message to verify with the iOS devs a time ago to verify the option, but they are quite busy at the moment.
     
  30. fishg

    fishg

    Joined:
    Jul 25, 2014
    Posts:
    90
    I use this tool can reduce 50%+ png file size.http://pngquant.org .
    Can integrate this tool?
     
  31. chaomian

    chaomian

    Joined:
    Jul 7, 2014
    Posts:
    3
    I have never try pngquant but I think you can do it. I actually plan to upload my game to Cydia apps store once I finished it.
     
    Last edited: Sep 18, 2015