- Home /
C# on iPhone unable to access Mono 2.6 features
The release notes for iPhone 1.6 said Mono was updated to Mono 2.6. However, none of the C# 3 features that are part of Mono 2.6 such as var are compiling. Is Unity iPhone specifically setting a compile flag to force .NET 2.1 only features? Is this necessary for Full AOT compilation? We can get C# 3 features in regular Unity with this hack but I'm not sure what to do for iPhone since the compiler looks to already be updated to 2.6 and there's no 3.0 option in the project's player settings.
If I have to just wait for Unity 3 I suppose that's acceptable, but considering iPhone apps don't depend on any sort of backwards compatibility and Mono has already been upgraded, it would be really nice to have the latest and greatest language features.
Answer by Mantas-Puida · May 27, 2010 at 09:47 AM
Support for some C# 3.0 features will come to Unity iPhone, but most likely some time after Unity 3.0.
Answer by Ashkan_gc · May 25, 2010 at 02:27 AM
what i am writing is just a guess. mono is a runtime with libraries and unity updated it's use of mono so you can compile things like dynamic language runtime for it and some other features but unity don't use the JIT compiler that mono has and wrote a ahead of time compiler. this compiler needs to be updated to support c# 3 features.
But the AOT compiler is part of the mono compiler toolchain, there's an AOT flag (--aot) you can pass in to get AOT compilation. I understand that "Full AOT" is a bit more involved and requires perhaps picking and choosing how the $$anonymous$$ono runtime is integrated into the execution environment and perhaps that is where the problem is.
-AOT is an option for compiling normal apps and it's what the jit do at runtime but iphone's AOT compiler has differences. i am not sure what are the differences exactly. i don't know if unity's mono compiler for the iphone has any relations with mono touch or not but i think you can send this question to support and they'll answer it or just tell some users to vote it up and then staff will notice it.
Answer by Lucas Meijer 1 · Oct 05, 2010 at 03:18 PM
You don't need that hack in Unity3 to use c# 3.0 features in the editor. Which specific piece of code is not working for you on the iphone? Please also make sure to disable all stripping.
(We allow agressive stripping, which at its strongest level removes quite a lot of mono functionality. Those levels are really intended for the "I dont care about this .NET stuff, I just want to make my dragon walk forward kthnxbyt" scenario)
Things seem to be working fine in Unity 3. $$anonymous$$y issue was with old iPhone 1.x after the $$anonymous$$ono 2.6 update.