Search Unity

[Official] The collected il2cpp forum topic.

Discussion in 'General Discussion' started by RalphH, May 20, 2014.

  1. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,215
    So will we :) Just bear in mind, while a .NET upgrade is 'the plan' it's still very much 'the long run' for now.

    The old AOT. Another way of looking at it is: if you have a fully-functioning iOS project under old-Mono AOT, and you switch it over to using IL2CPP, it should continue to work exactly as before. If it doesn't, we want to know about it ASAP, as that's a top priority bug for us right now.

    If it doesn't currently work correctly under old-Mono AOT, but is valid code that runs on other platforms under JIT, then it might work under IL2CPP - there are already a number of situations where IL2CPP supports things that old-Mono AOT does not. If it doesn't work under IL2CPP, then again, we want to know about it; these cases aren't as high-priority as the ones where old-Mono AOT beats IL2CPP, but we want to fix them all eventually.

    As mentioned before, the big exception to this is anything that does IL generation at runtime: the System.Runtime.Reflection.Emit namespace for sure, and things that use it - this does include some non-obvious things like Regex.

    No guarantees about that one, sorry. But as you say, some kind of static analysis might be possible eventually.
     
    JaredThirsk likes this.
  2. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,412
  3. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,215
    No news on that front yet, sorry.
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,175
    Unity already uses "real" .NET for windows store apps and WP8 apps.

    --Eric
     
    JaredThirsk and angrypenguin like this.
  5. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    12,225
    And can already deploy to "other windows devices (XBox, Win tablets and mobile)", as well.
     
  6. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,412
    Given that 4.6.2 (and 4.6.1p5) includes IL2CPP for iOS, does this mean IL2CPP is now available for WebGL in 4.6.2?

    Questions:
    1. Is IL2CPP is now available for WebGL in 4.6.2?
    2. Is a "Web Player" build in 4.6.2 a WebGL build?
    3. Where would I put my C++ source files to have them compiled with my project?
    4. How should I celebrate!!!!!? :)
     
  7. joncham

    joncham

    Unity Technologies

    Joined:
    Dec 1, 2011
    Posts:
    251
    1. No, WebGL is only available in 5.0 as a Preview
    2. No, it's a normal WebPlayer build
    3. I believe you can just drop them in the Assets folder
    4. Anyway you wish!

    All that said, I hope if you are interested in WebGL you give it a try in 5.0.
     
  8. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,412
    Thanks for your reply joncham,

    Oh, that's a shame (I though it was wishful thinking on my behalf!)

    Fantastic - do you know if we'll have the ability to drop code under the platform selective folders, eg:

    .../Assets/Plugins/iOS/MyCppCode/*.[cpp,h]
    .../Assets/Plugins/WebGL/MyCppCode/*.[cpp,h]
    .../Assets/Plugins/Android/MyCppCode/*.[cpp,h]

    etc?

    Will it also be possible to drop in a single version somewhere that will be built for all IL2CPP compatible systems? (rather than a copy for each platform) eg: .../Assets/Plugins/MyCppCode/*.[cpp,h]

    Both methods would be great so we could put platform non specific code in one place and then put source files that are platform specific under the selective folders.

    Also, I know that the Editor will not be IL2CPP enabled due to the hot loading changes etc but will there be the ability to include C++ code that can be built for testing in the editor - but not hot loaded? (or will we need to still supply native .dll to run in the editor?

    Sounds great, I'd love to do that right now but how can I get a copy of 5.0 to test this on? I can't find any download links.
     
  9. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    12,225
    Really? Sweet!
     
  10. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    I believe the goal is to phase into using IL2CPP for every platform (or most platforms anyway), but it's a work in progress. WebGL was really the first push for IL2CPP and likely would have been the only platform to utilize it for awhile if it weren't for Apple's deadline for 64-bit support. That being said, iOS was a natural pairing since it is already an AOT platform and IL2CPP is also AOT. That's one of the drawbacks of IL2CPP imho... I love the fact that things will be consistent across platforms when it rolls out to more of them, but I'm not a big fan of AOT as it doesn't really give you much of a gain and prevents some things from working or being possible.

    Yep, specifically for ios 64-bit support.
     
    movra likes this.
  11. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    12,225
    Cool. Do we still get it on our old 32bit devices?
     
  12. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,562
    No idea to be honest.... I don't know a whole lot about the apple ecosystem.
     
  13. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,175
    The answer is yes.

    --Eric
     
    angrypenguin likes this.
  14. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,412
    To expand on Eric5h5's answer - disclaimer, I'm not an IL2CPP expert (just played with it for a couple of days):

    In an IOS build using IL2CPP the generated CPP files are added to the XCode project and compiled by XCode - as such I assume you can produce iOS binaries for what ever XCode can compile to since it's just CPP code.

    So yes you can have 32bit armv7 and arm64 if that's what you want - please correct me if wrong.

    I've already done an IL2CPP build for armv7 and it runs fine on my old iPad 2 (non retina).
     
    Last edited: Jan 30, 2015
    angrypenguin likes this.
  15. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    7,168
    With IL2CPP would it be possible to compile to double precision floating point 3d maths, e.g. Vector3 would have 64 bit precision?

    As most game spaces in Unity need tweaks and tricks to extend beyond about 10000 units from origin as floating point errors start to affect precision of movement and physics.
     
  16. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,786
    I think you should take a step back with all your IL2CPP posts (in various threads) and re-read whats it's about.
     
  17. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    7,168
    IL2CPP is a way to port the intermediate language generated in .Net/Mono (the scripts in your Unity project are converted to this before they are run through the .Net/Mono virtual machine) and convert it into C++ so that it can be compiled to native code or to javascript for WebGL.

    Result a native or WebGL game without the overhead of Mono, and the performance benefits of C++.

    Unity plan to release the built to IL2CPP feature across all platforms in the 5.x release cycle.

    Am I missing something?
     
  18. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,786
    Yes, now you already answered to your own previous question here and partly other threads. IL2CPP does not magically add new features to those places, they need to be supported in the mono/.net part before compiling something. Some of your post seem to be like IL2CPP is the answer to missing x feature when it could possible have not anything to do with it.
     
  19. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    7,168
    IL2CPP allows the addition to Unity of C++ libraries like AMP (which provide CPU and GPU acceleration). Now these features can be added to Mono/C# as well see CUDAfy for an example.

    But IL2CPP could open the way to add C++ libraries and extensions to Unity. Making it easier to add on industry standard extensions (which often are built using C++ and can be added via DLL's or built into existing C++ projects).

    However this does not answer the question of whether or not double precision of 64 bit floating point will be an option for IL2CPP builds.
     
    Last edited: Feb 1, 2015
  20. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    How can il2cpp help to add C++ dlls? What would the additional benefit be compared to the already existing plugins?
    The only advantage I can see is that certain C++ libraries can be used in combination with WebGL that could not be used with the WebPlayer. But other that that, I can't see how the workflow would be improved significantly.
     
  21. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,215
    No.
     
  22. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    7,168
    Pity I thought that Unity 5 was 64 bit?!
     
  23. Tanel

    Tanel

    Joined:
    Aug 31, 2011
    Posts:
    508
    The editor will be a 64bit application.
     
  24. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,215
    It is. That's not relevant to what you're talking about.
     
  25. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    7,168
    Do or will DirectX and OpenGL support double precision?
     
  26. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,215
    D3D11 no; OpenGL I have no idea but I'm guessing also no. Whether they will in the future I have no idea. But this is still not really relevant to what you were asking about.
     
  27. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    7,168
    It looks like OpenGL 4.0 introduced double precision but can't find anything on DX and double precision support!?
     
  28. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,786
    It does not really matter cause it has nothing to do with IL2CPP
     
    angrypenguin likes this.
  29. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,175
    Unity 5 having a 64-bit editor has nothing whatsoever to do with Vector3 being single-precision. It could have been double-precision starting with Unity 1.0 if they designed it that way. They could change it to double-precision right now (oh, and by the way that would break everyone's code, but don't let a little thing like that stop you!).

    --Eric
     
    JaredThirsk and angrypenguin like this.
  30. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    7,168
    How would a floating point with double precision used in Vectors and Matrices break someones code, they would take up more memory and potentially have to be downcast to single precision float point values when passed to DirectX or OpenGL (<4.0)?
     
  31. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,215
    ...thus causing every piece of code which depends on the size of things being consistent to break (e.g. all places inside engine code where we use Vector3, as it's the same structure on the native side as you see on the managed side) as well as anything involving pointers. Hence, this isn't something IL2CPP can just 'translate' for you - the changes would reach very far across the engine.
     
  32. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    7,168
    But didn't the Kerbal Space program developers build their own double precision system so they could represent things to scale and accurately within the solar system.

    So it would be possible for Unity to provide a double precision system for larger simulations and games but it would not be easy, as the physics engine might need to be re-built to support double precision and the camera view would have to scale everything down to single precision for rendering in DirectX or OpenGL.

    Or Unity could provide a tutorial on how to make solar system and larger playing areas work within it's 32bit floating point system ;)
     
  33. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    That would lead to tons of bug reports. Even if Unity could internally use double precision in all areas including physics, there would still be issues with the graphics cards. Even if the actual position of game objects would be correct, it can not always be displayed correctly. I don't think this would be useful.
     
  34. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,215
    Yes. This does not mean that they just replaced all instances of Vector3 with Vector3Double.

    Anyway, this is really getting off topic for IL2CPP now.
     
  35. Ox_

    Ox_

    Joined:
    Jun 9, 2013
    Posts:
    93
    Does IL2CPP produce smaller .ipa/.apk/.whatev compared to Mono?
     
  36. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,175
    Larger, currently.

    --Eric
     
  37. Nubz

    Nubz

    Joined:
    Sep 22, 2012
    Posts:
    553
    @Arowx take a freakin breath wow.

    Half this page is your rambling off questions then answering for yourself in the next post quoting the poster before you and saying things totally unrelated to what they said.
     
  38. Vibs_appit

    Vibs_appit

    Joined:
    Feb 16, 2014
    Posts:
    53
    @Eric5h5 Just out of curiosity, any idea as to how and why it will produce smaller build size (ref: il2cpp release notes) in future, but produces larger atm?
     
  39. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,814
    Currently most of the binary (about 75%) is taken by type and method metadata (for reflection and other purposes). The larger part of that is generic instance types and methods. This metadata currently includes all inflations of generics types, so for example, List<int> and List<string> is going to be two different types, each taking precious space in the final binary. We're currently working on storing just the generic type itself, and inflating it at the runtime. This should reduce the space taken by generics significantly.
     
    JaredThirsk, Vibs_appit and Meltdown like this.
  40. Vibs_appit

    Vibs_appit

    Joined:
    Feb 16, 2014
    Posts:
    53
    @Tautvydas Zilys Thanks for the info. Can we expect the reduced build size in one of the upcoming versions of beta? My mono build is currently around 100~110mb and il2cpp is ~125mb. Can I expect it to go around 65~75mb? or am I being unrealistic?
     
  41. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,814
    I can't talk about numbers just yet - we don't know them ourselves. However, this size reduction only applies to binaries, not the whole application, and I doubt your binary is 100 MB.
     
  42. Vibs_appit

    Vibs_appit

    Joined:
    Feb 16, 2014
    Posts:
    53
    Of course not. That is my ipa size.
     
  43. brendan-vance

    brendan-vance

    Joined:
    Jan 16, 2014
    Posts:
    36
    Hello all,

    I'm on 4.6.2f1 and trying to get our project running on a 32bit iOS device using IL2CPP. It compiles, links, builds to device, etc..., but I'm hitting some weird crashes on launch of which I'm having a lot of trouble making sense. Right now for example I'm seeing an EXC_BAD_ACCESS in PersistentManager::RegisterAndAwakeThreadedObjectAndUnlockIntegrationMutex (this is on the very first scene, apparently on engine initialization!)

    Anybody have thoughts on how I should approach this problem?
     
    Last edited: Feb 5, 2015
  44. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,786
    brendan-vance likes this.
  45. brendan-vance

    brendan-vance

    Joined:
    Jan 16, 2014
    Posts:
    36
    FYI: 4.6.2p1 fixed whatever issues I was having initializing the engine! However, I believe I've discovered a bug in which C++ builds don't correctly discover custom attributes attached to function parameters; I'll try to get a test case together at some point today.
     
  46. charmandermon

    charmandermon

    Joined:
    Dec 4, 2011
    Posts:
    351
    Using 4.6.2 web services stopped working completely.

    Just installed the 4.6.2 p2 and it didnt fix the issue.

    My app was ready for submission until I realized it needed to be 64 bit for apple. I am stuck now :(

    Just filed a bug report with the project.
     
  47. charmandermon

    charmandermon

    Joined:
    Dec 4, 2011
    Posts:
    351
    Just read a few pages back looks like web services aren't added yet....thats too bad.

    Also I can't seem to get Game Center to work at all either. It worked on 4.6.1 perfectly. IL2CPP has no game center it seems.
     
  48. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    4,153
    @charmandermon

    We've made some changes in the last month or so to correct a few problems with Game Center. I think that it should be working, at least in the cases we know about. Could you please submit a bug with a project that reproduces the problem? We would love to get it fixed.
     
  49. charmandermon

    charmandermon

    Joined:
    Dec 4, 2011
    Posts:
    351
    I loaded my full project up on the bug report. http://fogbugz.unity3d.com/default.asp?672283_jsobclp4k6vqsl2l

    It was submitted and is on the asset store 2 months ago on 4.6.1
    Since then I have only made a few changes and tweaks. You can use this project to test full on web services by pressing the skip button on the create user screen. Skip auto generates a temporary server account for analytics.

    Then there is a few calls for GameCenter.
     
  50. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    4,153
    @charmandermon Thanks, we will have a look at this.