Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

4.6 iOS 64-bit beta

Discussion in 'iOS and tvOS' started by jonas-echterhoff, Jan 12, 2015.

  1. Lucas-Meijer

    Lucas-Meijer

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    175
    @Lars Blaabjerg & @Ly: thanks for the report, I just fixed Enum.IsDefined. workaround until next build is to implement a mini IsDefined yourself, by queriying the enum for its values, and comparing against those.
     
  2. Ly

    Ly

    Joined:
    Aug 5, 2013
    Posts:
    7
    Thanks a lot @Lucas Meijer for the fix. Yet I can't make a workaround as the code where the Enum.IsDefined() is called is inside the Google Protocol Buffers API, so I can't edit it.
     
  3. arsalan.malik

    arsalan.malik

    Joined:
    Feb 9, 2015
    Posts:
    1
    Any plans to support HandleRef? How and where can I file a bug?
     
  4. Lucas-Meijer

    Lucas-Meijer

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    175
    Ly: while defeinitely annoying, if this issue is a big blocker, you could compile the google protocol buffer library yourself, and do the change there.
     
  5. Ly

    Ly

    Joined:
    Aug 5, 2013
    Posts:
    7
    Ah ah yeah, I thought about it, but I spent enough time for now trying to make my project work using il2cpp, so I think I'll just wait for the next patch release now. Regarding the patch release frequency, I guess i'll not have to wait too long.
     
  6. Lucas-Meijer

    Lucas-Meijer

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    175
    @Hacky: I fixed the bug locally. Should land in the next patch release. Temporary workaround would be to serialize with a List<KeyValuePair> instead of Dictionary, but overall, relying on BinaryFormatter for persistent data is not a great idea, as the data it outputs is very strongly tied to the implementation of the .net framework that created it. It would be a lot safer to use something like json for persistent serialized data.
     
    Dustin-Horne likes this.
  7. Hacky

    Hacky

    Joined:
    Mar 22, 2013
    Posts:
    28
    Thanks a lot. I will use json for saving data in the future.
     
  8. brendan-vance

    brendan-vance

    Joined:
    Jan 16, 2014
    Posts:
    36
    It appears IL2CPP iOS projects do not correctly report custom attributes applied to constructor parameters when you access them via the Reflection API. We're working around it for now, but this bug affects frameworks like Zenject so it would be a useful fix. I filed a bug report with test case: 671476
     
  9. Alkimio

    Alkimio

    Joined:
    Apr 18, 2013
    Posts:
    10
    Hi, This is my problem..
    I could isolate the bug in an small project and already submitted it. (Case: 671513)

    I can confirm this works on 4.6.1p1 building with mono. The problem relies in IL2CPP iOS.

    Main.cs

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System;
    4. using System.Reflection;
    5.  
    6. public class Main : MonoBehaviour {
    7.     void Start () {
    8.         Type type = Type.GetType("Main");
    9.  
    10.         MethodInfo methodInfo = type.GetMethod ("X", Type.EmptyTypes);
    11.  
    12.         MethodInfo genericMethodInfo = methodInfo.MakeGenericMethod(new Type[] { typeof(Main) } );
    13.  
    14.         genericMethodInfo.Invoke(this, new object[0]);
    15.     }
    16.  
    17.     public static T X<T>() where T : MonoBehaviour
    18.     {
    19.         Debug.Log ("X");
    20.         return default(T);
    21.     }
    22. }

    This is the console output:

    Code (CSharp):
    1. Initialize engine version: 4.6.2p1 (d5c84eeb5d80)
    2. ArgumentException: The method has 1 generic parameter(s) but 1 generic argument(s) were provided.
    3.   at System.IO.StreamAsyncResult..ctor (System.Object state) [0x00000] in <filename unknown>:0
    4.   at System.Reflection.MonoMethod.MakeGenericMethod (System.Type[] methodInstantiation) [0x00000] in <filename unknown>:0
    5.   at Main.Start () [0x00000] in <filename unknown>:0
    6.   at Main.Start () [0x00000] in <filename unknown>:0
    7.   at Replacements.Attribute.CheckParameters (System.Object element, System.Type attributeType) [0x00000] in <filename unknown>:0
    8. Replacements.Attribute:CheckParameters(Object, Type)
    9. (Filename: currently not available on il2cpp Line: 4294967295)

    (Building with Mono, the logged result is: X).

    Is this a known issue? Is there any workaround?
    Our code heavily depends on this. It is a very big project whose Context is generated using Reflection.

    Our game is already in the App Store (Top Farm). So I think we will not have any problem uploading updates in 32bit until June, but we would like to have the 64 bit build fully working way before that.

    Thank you so much!

    Damian.
     
  10. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    I'm guessing this is the same as MakeGenericType. If you've already called your GenericMethod somewhere it might work (but probably not). I would expect that MakeGenericMethod would be supported to work once MakeGenericType is put in place.
     
  11. rjeon

    rjeon

    Joined:
    Feb 11, 2015
    Posts:
    6
    Ok, I will minimize my project to report. It might take a day because of big size of project. As soon as it is done, i will make a bug report and post replay with a case number.

    Thanks for quick replay.
     
  12. abutt1

    abutt1

    Joined:
    Jan 24, 2014
    Posts:
    18
    Great work by the Unity team on the IL2CPP stuff - mostly just works straight out of the box! You have all done an awesome job.

    The only issues we're really fighting against at the moment are:
    - 'out' array parameters in delegates appear to fail compilation in IL2CPP - I created bug report 671597 (with a horrible title...) here: http://fogbugz.unity3d.com/default.asp?671597_2hohghcvumh74jni This isn't the biggest issue for us, but i'm sure it will affect some people out there.
    - We use CoherentUI in a lot of our projects, and it doesn't appear to work at all in IL2CPP builds
     
  13. Lucas-Meijer

    Lucas-Meijer

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    175
    @Alkimo: Dustin is correct, today we only support MakeGenericType and MakeGenericMethod in a very very narrow subset of all cases. We have been hard at work (I lie, it's @joncham who has been hard at work), to make MakeGenericType and MakeGenericMethod work in all cases. I don't dare give an very precise ETA, but think in the range of a few weeks.

    @abutt1: Thanks for the report. Mind filing one on CoherentUI? we'd love to fix that one too.

    @brendan.vance: this is fixed internally, should be in the next build.

    @arsalan.malik: we will fix it, not sure if it will make next build. as a temporary workaround, you could modify the extern method you're calling to take a System.Object instead of a HandleRef, and then pass in the raw object, instead of wrapping the object in the handleref.
     
    brendan-vance likes this.
  14. NickSergeev

    NickSergeev

    Joined:
    Dec 19, 2012
    Posts:
    15
    Hi guys, anybody has build size issues with il2cpp/universal builds?
    We've switched to il2cpp backend and build size has grown dramatically, we need to hit <100mb requirement for our game and we're stuck, anybody knows a workarounds for this or any plans to fix that? Thanks!
     
  15. malyna

    malyna

    Joined:
    Jul 9, 2010
    Posts:
    105
    Hey there, i have the same problem, my assets folder weighs 60 MB and my final archive estimated by xcode is about 140 MB. Is it normal for current state of il2cpp?
    Settings - il2cpp, universal, iphone only
     
  16. hamstar

    hamstar

    Joined:
    Sep 25, 2013
    Posts:
    84
    @Lucas Meijer sorry to bother you as you must be busy. Are you (or anyone else) aware of any workarounds for the issues with the Parse plugin? I need to get an update out for a published game ASAP.
     
  17. RalphH

    RalphH

    Unity Technologies

    Joined:
    Dec 22, 2011
    Posts:
    592
    @hamstar, if you have an already published game you can update it without using the IL2CPP backend for now.
     
  18. RalphH

    RalphH

    Unity Technologies

    Joined:
    Dec 22, 2011
    Posts:
    592
    While we are working on size reduction in general, size will remain to be bigger then having only 1 architecture supported in the binary. Short term there's some change coming, but it really depends on the type of code & assets. How big was your mono build ?
     
  19. RalphH

    RalphH

    Unity Technologies

    Joined:
    Dec 22, 2011
    Posts:
    592
    Could you file a bug on the CoherentUI usage ?
     
  20. RalphH

    RalphH

    Unity Technologies

    Joined:
    Dec 22, 2011
    Posts:
    592
    Thanks for the report, Brendan. I think I have it fixed already (in an upcoming release, we have support for attributes on arguments, which we have none of in the currently released versions) but I'll verify with your test case to make sure that the fix needed is the same we already have for that scenario.
     
  21. RalphH

    RalphH

    Unity Technologies

    Joined:
    Dec 22, 2011
    Posts:
    592
    Thanks for the reports Florian. All three issues are now resolved (Lucas already reported having fixed the IsDefined bug), but missed the cutoff for the next-up public build, so won' t be in that version yet.
     
  22. ArjunN

    ArjunN

    Joined:
    Jan 18, 2013
    Posts:
    21
    Yes. We have the same issue. The build size is quite big even factoring in the requirement for a universal binary. We are way above the 100Mb requirement. Does Apple factor in the fact that the universal build effectively has 2 binaries in it when it comes to this size requirement?
     
  23. RalphH

    RalphH

    Unity Technologies

    Joined:
    Dec 22, 2011
    Posts:
    592
    I'm not able to speak for Apple on this. However, we're working on drastically reducing codegen size for IL2CPP in a number of steps, so improvements are coming down the line, albeit not in the next build, rather step-wise gradual improvement over future releases.
     
  24. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,033
    The 100MB limit is quite inflexible. There's no "size discount" based on types of data ;)

    I expect the limits to increase as mobile networks start to feel the competition, because then they'll start giving people more substantial traffic allowances. But until then: Please try really hard to shrink it down a bit more, UT :)
     
  25. hamstar

    hamstar

    Joined:
    Sep 25, 2013
    Posts:
    84
    @RalphH thank you so much! I can't believe I didn't know this!
     
  26. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Apple manuals have limit of 60mb for the binary and the 100mb is just for the over-the-air distribution which is optional
     
  27. Tyhja

    Tyhja

    Joined:
    Jun 21, 2013
    Posts:
    19
    When will that be available? Or if not stable, I wouldn't mind building on a patch release (and if so when will the patch release,with this fix be available? Our game is new but missed the feb deadline but can't go ahead now.
     
  28. RalphH

    RalphH

    Unity Technologies

    Joined:
    Dec 22, 2011
    Posts:
    592
    Trust me when I say we are pushing really hard for this, but it's not a simple one-liner fix; we'll get it in your hands as soon as we can.
     
  29. RalphH

    RalphH

    Unity Technologies

    Joined:
    Dec 22, 2011
    Posts:
    592
    It won't be in the current-to-be released patch release, but the one after. So at minimal that's a week away.
     
  30. Rasmus-K

    Rasmus-K

    Joined:
    May 13, 2013
    Posts:
    3
    Chipping in with our experiences: We have a project that went from ~95 MB to ~145 by switching to IL2CPP and including 64 bit support. The 145MB size was estimated by uploading a test build to iTunesConnect and seeing the size there.

    Can you provide any rough estimates on the size reductions we can expect in a not-too-far future? (Not looking for promises, but it would be nice to know the ballpark - do you expect to reduce it with 90%, cut it in half, reduce it with 10%?)
     
  31. rjeon

    rjeon

    Joined:
    Feb 11, 2015
    Posts:
    6
    @Lucas Meijer
    I sent a bug report and this case number is 671702

    We have plan to launch a game in March and this is first release on AppStore, so it must built with 64bit.
    As that reason, I really hope this bug would fixed in very soon patch


    Thanks :)
     
  32. Alkimio

    Alkimio

    Joined:
    Apr 18, 2013
    Posts:
    10
    @Lucas Meijer @RalphH @joncham

    Talking about build sizes this reminds the huge time it takes to build an IL2CPP build..

    Our big project takes 38 minutes to generate the Xcode project, and then another 25 minutes to build.

    With Mono it takes ~6 minutes to build the Xcode project and then ~4 minutes more.

    With a project with just 1 class (our test case demo project) with IL2CPP takes like 8 minutes to build the Xcode project and then 6 minutes more.


    It is a huge amount of time to build. Are you planning any improvement on this? It is related with the file size fixes?

    It hangs for minutes in "Postprocessing Player", before and after that step is pretty fast.

    Thank you!
     
  33. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    @echo17

    I've just made a change to support p/invoke with named libraries. It missed the cut-off for 4.6.2p2 though, so it won't be in until the next release (likely 4.6.3p1).

    In the meantime, you might be able to try changing the DllImport attribute to use the name "__Internal" this will avoid the native library look up and instead use the static libraries that are linked to find the proper native function. If you have the sqlite3 library linked, this should work.
     
  34. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    They have stated in other threads that they are contintually working on (and successfully) reducing build time. I would expect that to continue to improve.
     
  35. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,507
    There's an option in player settings to "Use IL2CPP Precompiled Headers". It may reduce build time in XCode - you could try that.
     
  36. jeffsherwin

    jeffsherwin

    Joined:
    Aug 22, 2014
    Posts:
    47
    Do not see this option on 4.6.2p2 ?

    Also Parse now crashes(EXC_BAD_ACCESS) instead of having null ParseUser.CurrentUser
    http://fogbugz.unity3d.com/default.asp?669983_jb5tk8md7pc2vh39

    Code (CSharp):
    1. 0x101af962c:  b.ne   0x101af9654               ; il2cpp::vm::Type::GetUnderlyingType(Il2CppType const*) + 52 at Type.cpp:750
    2. 0x101af9630:  ldr    x8, [x0]
    3. 0x101af9634:  ldr    x8, [x8]
    4. 0x101af9638:  ldrb   w10, [x8, #257]
    feels like a regression. A number of us are all BLOCKED with the Parse issue.
    Last week it was said this issue is priority zero there
    Clearly it's not in 4.6.2p2
    Can we get some sort of update? Can I help fix it?

    thanks
     
    Last edited: Feb 12, 2015
  37. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    @abutt1

    The out parameter issue is mostly fixed in 4.6.2p2. In the test project you submitted, the struct has no fields. As it turns out, we don't correct handle that case. However, if the struct has at least one field, it is working now in 4.6.2p2.

    I'll correct the no-field case for a future release.
     
  38. cojo71

    cojo71

    Joined:
    Aug 19, 2014
    Posts:
    26
    Just wanted to chime in here again / reiterate how critical this is for many of us. *Any* sort of communication of ETA, an explanation of why this is so much harder / taking so much longer to solve than other issues, *anything* beyond just "it's on our radar" would be greatly appreciated. Many of us have CEOs / managers / etc. (understandably) wanting to know why we can't deliver on major business initiatives weeks after we were originally expecting to do so - it would be nice to at least be able to communicate more accurate information to them if not have an actual workaround / solution.
     
  39. iTris666

    iTris666

    Joined:
    Jun 12, 2012
    Posts:
    11
    Hi,

    Here is a small bug with il2cpp where System.Type.GetArrayRank() is wrong for 1D arrays of Unity and standard types return zero. it is correct on user types :

    typeof(Renderer[]).GetArrayRank() //returns 0 ( should be 1 )
    typeof(string[]).GetArrayRank() //returns 0 ( should be 1 )
    typeof(SomeTypeOfOurs[]).GetArrayRank() //returns 1 OK
    typeof(string[,]).GetArrayRank() //returns 2 OK​

    It messes our custom json deserialization. I've posted a bug report on this issue.

    Keep the faith :)
     
  40. mcarriere

    mcarriere

    Joined:
    Sep 14, 2012
    Posts:
    106
    How do we ensure that the sqlite3 library is linked?
     
  41. NickSergeev

    NickSergeev

    Joined:
    Dec 19, 2012
    Posts:
    15
    Hello Ralph, thanks for your reply.
    Regarding unix executable - it was 30mb, now its 80mb, assets are around 70, so we're far from 100mb limit currently.
    Does anybody know will we be able to pass review with unix executable of that size at all?
     
  42. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    @mcarriere
    From what I understand about iOS (sorry, I'm not an expert on it), a sqlite3 dynamic library ships with the OS. So you can do something like this:

    Code (CSharp):
    1. [DllImport("sqlite3", CallingConvention=CallingConvention.Cdecl)]
    2. public static extern Result sqlite3_open([MarshalAs(UnmanagedType.LPStr)] string filename, out IntPtr db);
    If, however, you have a static sqlite3 library, you can link it as you would any other native static library and the p/invoke declaration would instead look like this:

    Code (CSharp):
    1. [DllImport("__Internal", CallingConvention=CallingConvention.Cdecl)]
    2. public static extern Result sqlite3_open([MarshalAs(UnmanagedType.LPStr)] string filename, out IntPtr db);
    The first argument to the DllImport attribute "__Internal" let's us know that this is a static library, not a dynamic one. This latter approach works now, the former is not yet working in 4.6.2p2. To make the latter approach work though, you will need a static library for sqlite3 for iOS.

    Unfortunately, I'm not sure about how to obtain one though.
     
  43. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    @cojo71

    This is on our radar, sorry that we did not communicate sooner. Some in-progress work should correct this problem. We'll know more in a day or so when that work lands internally. I'll provide another update here when I can give more firm details.
     
  44. cojo71

    cojo71

    Joined:
    Aug 19, 2014
    Posts:
    26
    Awesome, thanks for the details! Much appreciated :)
     
  45. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    204
    @Lucas Meijer : did the new patch release that came out today include the aforementioned BestHTTP network support fixes? i saw some async fixes and some socket fixes but didn't see it explicitly in release notes...
     
  46. jeffsherwin

    jeffsherwin

    Joined:
    Aug 22, 2014
    Posts:
    47
    FYI for all the Parsed blocked people:
    this is from Parse bug list - seems like an official response:
    https://developers.facebook.com/bugs/1413897332236082/
    Stanley Wang · · Facebook Team
    Hey guys, we are currently blocked by bugs in IL2CPP. We have communicated these blocking issues and their urgency with Unity. We've been told that the earliest time that Unity will fix these issues is at their 4.6.3 release. Until then, we will try our best to find workarounds for the bugs in IL2CPP, but it's unlikely that we'll have an update before Unity releases their 4.6.3 version. If you need to release an iOS Unity app urgently, you may also consider calling our REST API directly (https://www.parse.com/docs/rest), bypassing the Parse Unity SDK.
    ----
    Seems like alot of churn and frustration could have been avoided had this message been communicated here.
     
  47. mcarriere

    mcarriere

    Joined:
    Sep 14, 2012
    Posts:
    106
    Is there an ETA for 4.6.3p1?
     
  48. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    454
    @Lucas Meijer, was bug 670410 fixed in 4.6.2p2? I'm still experiencing the problem in that build.
     
  49. rairala

    rairala

    Joined:
    Aug 21, 2014
    Posts:
    4
    Thanks.

    Just to make sure I understood the situation right : Will dynamic imports be reintroduced, then ?
    It might work if we were to implement a boilerplate layer in Objc and reimport it as a plugin as usual, didn't try it out yet.
     
  50. abutt1

    abutt1

    Joined:
    Jan 24, 2014
    Posts:
    18
    @Lucas Meijer, @RalphH, @JoshPeterson

    Sorry it's taken so long to reply about the coherent issue. After running it on 4.6.2p2 and reading a bit more of this thread, it's likely the same thing that other posters are seeing with "PInvoke is not yet supported on Posix platforms."

    I've uploaded a bug (671992) at: http://fogbugz.unity3d.com/default.asp?671992_mviuqpu4gk2b2rbf

    Note that there is another coherent problem, (only present in editor - it will crash every second scene run): http://fogbugz.unity3d.com/default.asp?669336_25mbv0nbgics37g6 . That's not related however, just annoying ;)