Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

4.6 iOS 64-bit beta

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

  1. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Update Feburary 19th: We have just released Unity4.6.3 which contains many iOS il2cpp improvements: http://blogs.unity3d.com/2015/02/19...ndering-support-and-update-of-il2cpp-for-ios/

    Update January 29th
    :
    We have just released Unity 4.6.2 which contains il2cpp for iOS and iOS 64-bit support.


    -----------------------------------------------------------------------------------------------------------------
    Update January 23rd: We have just released Unity 4.6.1p5 which contains il2cpp for iOS and iOS 64-bit support.


    Original Post:
    -----------------------------------------------------------------------------------------------------------------

    We posted Unity 5.0 b19 in the Unity 5 Pre-Order Beta forum today for 5.0 pre-order customers. This build added iOS il2cpp and 64-bit support.

    As we wrote before, we are also committed to bringing iOS il2cpp and 64-bit support back to Unity 4.6. So, here is the first public beta release (designated #2, #1 was a private beta only) of Unity 4.6 with iOS 64 support.

    Please make sure you test this with us on projects you are currently developing or have on the appstore today; as per the Apple announcements, 64-bit support will be required for new apps starting the 1st of February 2015 and for that you will need to build with ARM64 and thus, IL2CPP support.

    This build of 4.6 does not yet support Metal, that will come in a later beta. This build is in sync on IL2CPP support with Unity 5 b19 ARM64 build and is for the rest roughly equivalent to the latest 4.6 patch release build.

    For more context about that that means; we've recently blogged about ios and ARM64 here; and we've got an in depth post on our strategy with IL2CPP here.
    This build is early beta quality, with known issues, but we wanted to start getting builds out to you and see / hear how your project is doing on IL2CPP.


    Some notes on work in progress / current state of this build.

    • To enable IL2CPP and ARM64 support you should switch scripting backend to "IL2CPP" in the Player Settings/iOS tab.
    • Build times are much longer, we are working on this.
    • Build sizes are currently bigger than with Mono, we are working on this, but note that shipping a universal build will always be bigger due to the fact it ships both a 32bit and 64bit executable.
    • This build is intended for iOS IL2CPP testing only, other platforms might not work as well as on general Unity 4.6 patch release builds.
    • There is known issue that uGUI input fields won't work with touch keyboards. Fix is on the way
    • There is a known issue with codegeneration for marshalling of array of structs for pinvokes. If your project does this, it will fail to compile. This will be fixed in the next build.
    Things we haven't implemented yet;

    • WebRequest API is not yet supported with IL2CPP, we are working on it.
    • iOS simulator builds are not supported with IL2CPP backend, we are working on it.
    • Managed code debugger is in progress, but won't be available for initial release. For quite some time you would need to rely on Xcode debugger, which is now easier to use than with Mono scripting backend. If you need to debug managed code and rely on Monodevelop, you might consider switching back to mono backend for this task.
    Please do note that Prime31 plugins are supposed to work with an updated version from those plugins by Prime31. Other plugins might or might not; we'd love to hear about those you are using that aren't working correctly.

    Download and test!

    You can download latest build here:

    http://beta.unity3d.com/download/4933178406/download.html

    Please test your projects with this build and post feedback bugs for any issues you find. Please post case numbers of bugs specific to this build in this thread so we have a fast path for finding and verifying reports.

    Kind Regards,
    The iOS & IL2CPP team.
     
    Last edited by a moderator: Feb 19, 2015
    XCO, drawcode, r618 and 2 others like this.
  2. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Thank you Jonas, I will give this a test, I guess best test is also to see if I can upload build to Apple and confirm the game working on, will pass Apple submission process without any issues.

    I look forward to this:
    There is known issue that uGUI input fields won't work with touch keyboards. Fix is on the way
    This is a blocker for myself as using uGUI in the game often have fields where user needs to enter name of save file, character name, just things like this.

    So I will wait for this before submitting game to Apple using the beta build

    Cheers
     
    Last edited: Jan 12, 2015
  3. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    One other thing, this build is based on 4.6.1 final? or includes some patch releases with it?
     
  4. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    From the original post:

     
    MrEsquire likes this.
  5. Funny-Face

    Funny-Face

    Joined:
    Nov 6, 2013
    Posts:
    17
    • WebRequest API is not yet supported with IL2CPP, we are working on it.
    Any ETA for WWW implementation? Because our game heavily depends on this.
    Thank you.
     
  6. Lucas-Meijer

    Lucas-Meijer

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    175
    UnityEngine.WWW works fine. System.Net.WebRequest support is pending. (Actually I think it already works if you talk to a webserver that sends data non compressed, but it currently fails if the server decides to send gzipped response)
     
    drawcode likes this.
  7. Funny-Face

    Funny-Face

    Joined:
    Nov 6, 2013
    Posts:
    17
    Oh thanks.
    I'll try build our game with this beta and reach you back as soon I have time.
     
  8. Dmitry-Pyalov

    Dmitry-Pyalov

    Joined:
    Dec 13, 2011
    Posts:
    125
    Could it be that DES Cryptography API is not supported?

    I'm getting

    NullReferenceException: A null value was found where an object instance was required.


    somewhere in the code:

    var des = DES.Create();
    des.Key = new byte[] { /* some private info */ };
    des.IV = new byte[] { /* some private info */ };


    when I build for IL2CPP. It works fine with Mono though.
     
  9. Liszt

    Liszt

    Joined:
    Jan 12, 2015
    Posts:
    29
    The build time takes more time (but you warn us) //
    The precompiling time is REALLY longer in XCODE and created some freeze (sometimes)

    == Not really worried about that ==
    There is a loooot of unused variable generated ! (format : V_X )

    There is a lot of :
    Code (CSharp):
    1. Implicit conversion loses integer precision: 'uintptr_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int')" in all bulk file generated. (bulk mscorlib and Assembly-CSharp files generated)
    There is "loses integer precision" too in WWWConnection.mm // iPhone-sensors.mm // UnityAppControler+Rendering.mm // DisplayManager.mm // PlatformInvoke.h

    There is some "Integer constant is larger than the largest signed integer type" in your generated files too.

    == This worried me a little bit more :s ==
    I've got a lot of these errors (not always the same, i can send you the details for each one if this can help you to solve this or maybe it's something that we must patch from our side) :
    Code (CSharp):
    1.  
    2. (null): Direct access in mscorlib_mscorlib_System_Collections_Generic_List_1_mscorlib_System_Object_git_m_System_Collections_IList_Add_gshared(mscorlib_mscorlib_System_Collections_Generic_List_1_mscorlib_System_Object_git*, mscorlib_System_Object*) to global weak symbol typeinfo for Il2CppExceptionWrapper means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
    My build is broken actually with the IL2CPP version.

    We used some plugins and I try to investigate on them too to see if they can create some problem with unity IL2CPP version.
    The plugin seems ok (Facebook / Adjust / HockeyApp / Our own InAppPurchase ObjC script ).

    I investigate to find the maximum location issue to give you the most precises feedback.

    If you need more information about this build or other just ask.
     
    protopop likes this.
  10. smktang

    smktang

    Joined:
    May 15, 2013
    Posts:
    6
    Just to confirm, if System.Net.WebRequest is being used, how would it break? I may be including some plugins that may use it, but I'm unsure (I don't see it referenced in any source). I am getting 5 linker errors, possible related to gzip stream, since the missing references are:

    _Flush
    _WriteZStream
    _ReadZStream
    _CloseZStream
    _CreateZStream

    This may sound strange, but is it "breaking correctly?" :)
     
  11. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    1,298
    fwiw resulting build size is horrendous atm, an app with practically 1 empty scene is ~150 MB on device - there is probably no stripping in free version though

    for some reason there's no sound (locally streamed mp3) ; I'll see if I could pull myself together and bugreport it
     
  12. joncham

    joncham

    Unity Technologies

    Joined:
    Dec 1, 2011
    Posts:
    276
    It could be that the DES.Create call fails due to stripping of code. Please file a bug report for us to investigate this.
     
  13. joncham

    joncham

    Unity Technologies

    Joined:
    Dec 1, 2011
    Posts:
    276
    That indeed sounds like breaking correctly ;)
     
  14. joncham

    joncham

    Unity Technologies

    Joined:
    Dec 1, 2011
    Posts:
    276
    Are you building in debug or release? Sizes are definitely smaller with stripping enabled and in release. At this point, they are generally 20-30% larger than mono. We are actively working on improving this.

    As for the audio, there is a known issue with "streamed from disk" sounds on ARM64. It will be fixed in a future release.
     
  15. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    1,298
    no idea, just hitting run button in Xcode ;)
    but the local development build ( not to be confused with development build in iOS player setting - that is off ) in Xcode is probably a debug one and Archive / Submission build/s are with Release config - but, frankly, I'm not entirely sure - just 150 MB seemed little bit too much for either one; I'll keep an eye on this

    thanks for confirmation!
    Edit: the testing device is not an arm64 one though, will try with next release
     
    Last edited: Jan 13, 2015
  16. FrenzooInfo

    FrenzooInfo

    Joined:
    May 2, 2014
    Posts:
    44
    Just started testing with our project. We are getting "Parse Issue" with the generated code.

    Code (CSharp):
    1. static const int32_t System_System_System_Collections_Generic_SortedList_2_EnumeratorMode_mscorlib_System_ObjectU002CU0020mscorlib_System_Object_git_KEY_MODE_DefaultValueData = ;
    2. static Il2CppFieldDefaultValueEntry System_System_System_Collections_Generic_SortedList_2_EnumeratorMode_mscorlib_System_ObjectU002CU0020mscorlib_System_Object_git_KEY_MODE_DefaultValue =
    3. {
    4.     &System_System_System_Collections_Generic_SortedList_2_EnumeratorMode_mscorlib_System_ObjectU002CU0020mscorlib_System_Object_git_KEY_MODE_FieldInfo/* field */
    5.     , { (char*)&System_System_System_Collections_Generic_SortedList_2_EnumeratorMode_mscorlib_System_ObjectU002CU0020mscorlib_System_Object_git_KEY_MODE_DefaultValueData, IL2CPP_TYPE_I4 }/* value */
    6. };
    7.  
    First line generates something to the effect of "blah = ;" basically no default value?
     
  17. Liszt

    Liszt

    Joined:
    Jan 12, 2015
    Posts:
    29
    Other thing that I remark (I know this example is not smart but this generate an error during the build phase) :

    Code (CSharp):
    1. #if UNITY_WEBPLAYER
    2.         StartCoroutine( InjectJS() );
    3. #endif
    and this

    Code (CSharp):
    1. IEnumerator InjectJS()
    2.     {
    3.        //Some code here
    4. #if !UNITY_FLASH
    5.             Application.ExternalEval( www.text.Replace( "\n", string.Empty ).Replace( "\r", string.Empty ) );
    6.            //Some code here
    7. #endif
    8.     }
    This generate an error with the Application.ExternalEval cause it's available only for Webplayer. This must be excluded earlier with the first "#if UNITY_WEBPLAYER" but it seems not :(

    And did you have some answer to my previous post issues ?
     
    Last edited: Jan 13, 2015
  18. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,646
    Which error does it generate? And did this compile successfully under the regular 32-bit pipeline in 4.6.1?
     
  19. Liszt

    Liszt

    Joined:
    Jan 12, 2015
    Posts:
    29
    With Unity 4.6.1 in a regular 32bits pipeline it works fine. But when I swich to 64bits IL2CPP pipeline this generate and error during unity building phase.
    The error is :
    `UnityEngine.Application' does not contain a definition for `ExternalEval'. The problem is that he didn't exclude the coroutine with the first "#if"
     
  20. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,646
    Can you please copy and paste the exact error message?

    My suspicion is that it's correct to fail to build in this way, but I'm surprised that it worked before. The compiler isn't able to eliminate code just because you aren't calling it any more; it's the build stripper which does that sort of thing, and that's run later in the process. So, if you're getting a compiler error, that would make sense, though it still makes me wonder why it worked before.
     
  21. Liszt

    Liszt

    Joined:
    Jan 12, 2015
    Posts:
    29
    I just put the error in my previous post in bold ;).
    But I confirm in mono (2.x) build no problem but with IL2CPP backend there is this error.

    I tried a new build and remove some libs to see if something change or not.

    The first that I can say is :
    - The indexing phase (in xcode) takes a really really long time (x30-50 longer)
     
    Last edited: Jan 13, 2015
  22. FrenzooInfo

    FrenzooInfo

    Joined:
    May 2, 2014
    Posts:
    44
    Addendum to previous issue:
    Just did a small example:
    Code (CSharp):
    1. SortedList<string, Color> colorParams = new SortedList<string, Color>();
    2. SortedList<string, object> colorParams2 = new SortedList<string, object>();
    3.  
    I believe that SortedList is creating the problem with the parse issue.
    We too have the 5 related (gzip) linker errors, although not quite sure where it is being used atm.

    cheers

    Kevin
     
  23. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,912
    If you are seeing a build error that occurs with iOS/IL2CPP, but not with iOS/Mono, please submit a bug and include an example project. We would like to see the problem and correct it. Thanks.
     
  24. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,912
    @FrenzooInfo It looks like IL2CPP is definitely generating some bad code here. Can you submit a bug with the project that causes this problem? We will need to correct this. Thanks.
     
  25. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,912
    @FrenzooInfo, Sorry, I just saw this latest message now.

    I've tried these two SortedList lines, and they do compile correctly, so there might be a bit more to this problem. If you can submit a full project, that would be best.

    Also, the 5 linker errors related to gzip should be corrected in our next beta release.
     
  26. Lucas-Meijer

    Lucas-Meijer

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    175
    Kevin, could you file a bugreport for the SortedList issue?
    No need to file a bug for the 5 gzip related linker errors, we have a fix for that coming down the pipe.
     
  27. jxxxxst

    jxxxxst

    Joined:
    Nov 3, 2012
    Posts:
    50
    Hey there, encountered a possible bug:

    I am tinting some Spritematerials for a simple day and night cycle using Color32.Lerp:

    Code (CSharp):
    1. SpriteMaterialTint = Color32.Lerp(SpriteMaterialsDayTint, SpriteMaterialsNightTint, tweenProgress / tweenDuration);                            
    2.  
    3. for(int i = 0; i < SpriteMaterialsToTint.Length; i++) SpriteMaterialsToTint[i].color = SpriteMaterialTint;
    This worked without a problem so far, but on IL2CPP I seem to get wrong color values. The tween doesn't start with the SpriteMaterialsDayTint Color, it starts with plain black.

    I use Color32.Lerp somewhere else and again do not get it's desired behaviour.
     
    Last edited: Jan 13, 2015
  28. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,912
    This is definitely something that we want to investigate. Can you first confirm that this behavior is correct when building for iOS with the Mono backend? If so, can you submit a bug with a project that demonstrates the problem? That will help us to correct it. Thanks!
     
  29. jernau75

    jernau75

    Joined:
    Sep 3, 2013
    Posts:
    2
    Hi,

    I'm testing our build against 4.6.1p3 and am receiving an error message from BuildPipeline.BuildPlayer:

    Error building Player: ArgumentNullException: Argument cannot be null.
    Parameter name: key

    And that's all I get. Does anyone know of a way of getting more info about the location of the offending argument? There's no callstack or other identifying information that I can see - either in Unity or in the editor log file - and as you'll appreciate, "key" is quite a common parameter name..! :)

    To clarify, this occurs no matter what my "Architecture" field is set to in Player Settings, so it doesn't look like an ARM64-specific issue. I can still successfully build to iOS from 4.6.1p2. I've changed no other build or player settings in 4.6.1p3.

    I'm afraid I'm not in a position to upload our project in a bug report (in its entirety or in a cut-down form), but any light you can shed on how to dig in to the error message / spit out more logging info would be greatly appreciated.

    Thanks in advance,
    Alex
     
  30. Wiliz

    Wiliz

    Joined:
    Feb 18, 2014
    Posts:
    20
    I'm having some issues with debugging the generated C++ code in Xcode.

    For example, if you find the C++ code corresponding to some piece of script, and put a breakpoint in it, Xcode doesn't seem stop on it. Also, if the app crashes on a device, the call stack in Xcode shows random locations in code instead of where the calls actually came from.

    These issues are making it almost impossible to get any useful information out of Xcode when trying to debug the IL2CPP problems. Is this something you've seen yourselves, and if so, do you have any suggestions on how to get Xcode debugging working correctly?

    I've tried both Xcode 6.1 and 6.1.1. Also, I'm building the app with the Debug configuration and optimisations are off.
     
    Last edited: Jan 13, 2015
  31. jxxxxst

    jxxxxst

    Joined:
    Nov 3, 2012
    Posts:
    50
    Confirmed it and uploaded an example project.
    Report number is : 662939

    Best,
    Jan
     
  32. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,912
    Great, thanks Jan. We will have a look at this one.
     
  33. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,912
    Are are seeing the same issues locally. They seem to be something that only started happening recently, although I'm not sure sure about their cause. We are investigating why debugging the generated code is not working now. Unfortunately, I don't have any suggestions to improve the situation at this time.
     
  34. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,912
    @jernau75 Do you mind posting the full Editor.log file? We might be able to find something in it to hint at the cause of the problem. As it is, that error message doesn't provide any help, I agree.
     
  35. FrenzooInfo

    FrenzooInfo

    Joined:
    May 2, 2014
    Posts:
    44
    Hi Josh,
    I've managed to drill down further. The parse errors don't happen if you have stripping disabled. Any form of stripping will generate bad code.

    Cheers
    Kevin
     
  36. Umai

    Umai

    Joined:
    Jun 18, 2013
    Posts:
    74
    Ok Im about to try this out, moving from latest 4.6 to the beta. Is Unity 4.6.1p3 still the latest beta version?

    I got some runtime error. Does this mean List:s can't be serialised? Anyway the exception below somehow does NOT crash the app (maybe because of some debug state, the device is connected to Xcode by wire), however it stops it from working - a scripted sequence just stops midways. I'm using one of those tween plugins (DOTween), not sure if it supports 4.6.1p3 etc yet.

    SerializationException: Could not find type 'System.Collections.Generic.List`1[[Card, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]'.

    at Poker.ratingOfPokerHand (.Deck hand) [0x00000] in <filename unknown>:0

    at Poker.ratingOfPokerHand (.Deck hand) [0x00000] in <filename unknown>:0

    at ScriptGame.isgreatratingofhand (.Deck hand) [0x00000] in <filename unknown>:0

    at ScriptGame.decidefancyanimationofhighvaluehands (Int32 slotindex) [0x00000] in <filename unknown>:0

    at ScriptGame+<placevcard3>c__AnonStorey1C.<>m__23 () [0x00000] in <filename unknown>:0

    at DG.Tweening.Core.TweenCallback.Invoke () [0x00000] in <filename unknown>:0

    at DG.Tweening.Tween.DoGoto (DG.Tweening.Tween t, Single toPosition, Int32 toCompletedLoops, UpdateMode updateMode) [0x00000] in <filename unknown>:0

    at DG.Tweening.Core.TweenManager.Update (UpdateType updateType, Single deltaTime, Single independentTime) [0x00000] in <filename unknown>:0

    at DG.Tweening.Core.DOTweenComponent.Update () [0x00000] in <filename unknown>:0


    (Filename: currently not available on il2cpp Line: 4294967295)


    Also I see a lot of warnings like this:
    • Unused variable 'V_4'
    • Implicit conversion loses integer precision: 'NSInteger' (aka 'long') to 'int'
    • direct access in System_System_System_Collections_Generic_Stack_1_mscorlib_System_Object_git_m_System_Collections_ICollection_CopyTo_gshared(System_System_System_Collections_Generic_Stack_1_mscorlib_System_Object_git*, mscorlib_System_Array*, int) to global weak symbol typeinfo for Il2CppExceptionWrapper means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
    • Integer constant is larger than the largest signed integer type
     
    Last edited: Jan 14, 2015
  37. Lucas-Meijer

    Lucas-Meijer

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    175
    Umai:

    The warnings are expected, we have some work ahead of us to reduce/kill warnings coming from generated code.

    W.r.t. your serialization error, does that not happen on mono? Can you try if adding this line to any monobehaviour class makes it go away:

    public System.Collections.Generic.List<Card> _unused = new System.Collections.Generic.List<Card>();
     
  38. commodore

    commodore

    Joined:
    May 30, 2012
    Posts:
    40
    How do I enable IL2CPP in the player settings?
     
  39. Liszt

    Liszt

    Joined:
    Jan 12, 2015
    Posts:
    29
    In the backend section. Choose IL2CPP and not mono 2.X. Then build your app.
     
  40. commodore

    commodore

    Joined:
    May 30, 2012
    Posts:
    40
    I feel like an idiot but I don't see where the backend is

    http://i.imgur.com/X1i5qWe.png
     
  41. Umai

    Umai

    Joined:
    Jun 18, 2013
    Posts:
    74
  42. Umai

    Umai

    Joined:
    Jun 18, 2013
    Posts:
    74
    If the the latest official 4.6.1 counts as mono, no it does not happen. If you mean that I should try compiling it again using Mono instead of IL2CPP using 4.6.1p3 then I have to try that...

    bbl
     
  43. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    I believe we traced down cause of this issue. We are putting all generated code into "__managed" code segment section and that makes Xcode lost when debugging. You could try disabling it in Xcode project by modifying Libraries/libil2cpp/include/il2cpp-config.h and replacing there:
    Code (csharp):
    1.  
    2. #define IL2CPP_METHOD_ATTR __attribute__((section ("__TEXT,__managed")))
    3.  
    with
    Code (csharp):
    1.  
    2. #define IL2CPP_METHOD_ATTR
    3.  
    Note: this will break reporting of managed exception stacktraces
     
  44. e-kornyushenko

    e-kornyushenko

    Joined:
    Aug 26, 2013
    Posts:
    1
  45. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,640
    Looks like it isn't there. Are you sure you installed and opened Unity that was downloaded from the link posted in this thread?
     
  46. Umai

    Umai

    Joined:
    Jun 18, 2013
    Posts:
    74
    I'm just gonna take a wild guess here but I think my app choked on this function which deep copies/clones any object (marked as [System.Serializable]) by serialising it and then unserialising it... hm... it worked until now :)

    Code (CSharp):
    1. public static T Clone<T>(this T source) { // In case you prefer to use the new extension methods of C# 3.0, change the method to have the following signature:
    2.         //public static T Clone<T>(T source) {
    3.         if (!typeof(T).IsSerializable) {
    4.             throw new ArgumentException("The type must be serializable.", "source");
    5.         }
    6.  
    7.         // Don't serialize a null object, simply return the default for that object
    8.         if (object.ReferenceEquals(source, null)) { // JGHG: changed Object into object
    9.             return default(T);
    10.         }
    11.  
    12. #if UNITY_IOS
    13.         ObjectCopier.SetEnvironmentVariables(); // JGHG added
    14. #endif
    15.         IFormatter formatter = new BinaryFormatter();
    16.         Stream stream = new MemoryStream();
    17.         using (stream) {
    18.             formatter.Serialize(stream, source);
    19.             stream.Seek(0, SeekOrigin.Begin);
    20.             return (T)formatter.Deserialize(stream);
    21.         }
    22.     }
    23. /*SetEnvironmentVariablesrequiredtoavoidrun-timecodegenerationthatwillbreakiOScompatibility
    24. * SuggestedbyNicodePoel:
    25. * http://answers.unity3d.com/questions/30930/why-did-my-binaryserialzer-stop-working.html?sort=oldest
    26. */
    27. privatestaticvoidSetEnvironmentVariables() {
    28. //http://answers.unity3d.com/questions/30930/why-did-my-binaryserialzer-stop-working.html?sort=oldest
    29. Environment.SetEnvironmentVariable("MONO_REFLECTION_SERIALIZER", "yes");
    30. }
    31.  

    I was able to make my app avoid the problem by writing a manual copy constructorish function on the class that I was copying.

    Then I found another problem a few seconds later:

    Code (CSharp):
    1. SerializationException: Could not find type 'System.Collections.Generic.EqualityComparer`1+DefaultComparer[[POKERHAND_RATING, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]'.
    2.   at VivideEngine.checkandreportachievementsatendofstage () [0x00000] in <filename unknown>:0
    POKERHAND_RATING is just an enum like this:

    Code (CSharp):
    1.  
    2. publicenumPOKERHAND_RATING {
    3. INVALID = 0,
    4. HIGHCARD, //1
    5. ONEPAIR,
    6. TWOPAIR,
    7. THREEOFAKIND,
    8. STRAIGHT, //5
    9. FLUSH,
    10. FULLHOUSE,
    11. FOUROFAKIND,
    12. STRAIGHTFLUSH,
    13. ROYALSTRAIGHTFLUSH//10
    14. }
    15.  
    Hmm this forum interface kills most of my spaces...
     
    Last edited: Jan 14, 2015
  47. Wiliz

    Wiliz

    Joined:
    Feb 18, 2014
    Posts:
    20
    Thanks, this does seem to fix the debugger. It's good enough as a workaround for now.
     
  48. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,912
    Thanks for tracking this down. We actually have a bug that we are actively investigating for this same issue (case 662564). For the time being, it is best to disable stripping iOS player options. Note that for IL2CPP, we are always doing byte code stripping of the IL code before the IL -> C++ conversion (even if the stripping setting is disabled). So you should still see the benefits of stripping.

    Of course, IL2CPP is generating binaries that are larger than Mono AOT, but we are also working actively to improve the binary size.
     
  49. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,912
    @e.kornyushenko Thanks for reporting this bug. It has actually already been corrected internally already. I've just verified that the project you submitted with the bug builds correctly using the code for the next 4.6 beta release.
     
  50. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,912
    @Umai this most recent error looks similar one you reported a bit earlier. Have you been able to try the suggestion @ljmeijer made in this case as well?

    Defining a field like this:

    public System.Collections.Generic.EqualityComparer<POKERHAND_RATING> _unused = new System.Collections.Generic.EqualityComparer<POKERHAND_RATING>();

    should cause the IL2CPP AOT compiler to generate C++ code for the EqualityComparer<POKERHAND_RATING> type, which I believe will work around the problem. If it does not allow things to work, please submit a bug with a project that reproduces this issue (if possible).

    We're working to improve the ability of IL2CPP to construct generic types at runtime, but at the moment we need to do some work arounds like this.