Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: MrCoCheese on November 15, 2012, 10:35:51 AM

Title: Interaction on iOS
Post by: MrCoCheese on November 15, 2012, 10:35:51 AM
Greetings,

I have just updated to 2.2.6 and I can no longer interact with NGUI any more (can't touch buttons) on iOS.
This version works fine on Android and the Web player.
The iOS version was all working correctly on 2.2.3.
Is anyone else having this problem?

Andrew
Title: Re: Interaction on iOS
Post by: nah0y on November 15, 2012, 11:29:57 AM
I'm having the same problem here, and here is what I have in XCode console :

  1. ExecutionEngineException: Attempting to JIT compile method 'System.Linq.OrderedEnumerable`1<UnityEngine.RaycastHit>:GetEnumerator ()' while running with --aot-only.
  2.  
  3.   at System.Collections.Generic.List`1[UnityEngine.RaycastHit].AddEnumerable (IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0
  4.   at System.Collections.Generic.List`1[UnityEngine.RaycastHit]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0
  5.   at System.Linq.Enumerable.ToArray[RaycastHit] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
  6.   at UICamera.Raycast (Vector3 inPos, UnityEngine.RaycastHit& hit) [0x00000] in <filename unknown>:0
  7.   at UICamera.ProcessTouches () [0x00000] in <filename unknown>:0
  8.   at UICamera.Update () [0x00000] in <filename unknown>:0
  9.  
  10. (Filename:  Line: -1)


Edit : And I guess it's coming from the
  1. using System.Linq;
you've added ?
Title: Re: Interaction on iOS
Post by: ArenMook on November 15, 2012, 02:22:36 PM
I'll upload a fix in a minute. Seems iOS doesn't like Linq. (thanks Nicki!)
Title: Re: Interaction on iOS
Post by: nah0y on November 15, 2012, 02:46:37 PM
LoL why Nicki ?
Title: Re: Interaction on iOS
Post by: ArenMook on November 15, 2012, 10:08:36 PM
Nicki sent me the bug report as well as a fix for it.
Title: Re: Interaction on iOS
Post by: masterprompt on November 15, 2012, 11:48:12 PM
  1. Unhandled Exception: System.ExecutionEngineException: Attempting to JIT compile method '(wrapper managed-to-managed) UnityEngine.RaycastHit[]:System.Collections.Generic.ICollection`1.CopyTo (UnityEngine.RaycastHit[],int)' while running with --aot-only.
  2.  
  3.   at System.Linq.Enumerable.ToArray[RaycastHit] (IEnumerable`1 source) [0x00027] in /Applications/buildAgent/work/51c26656ff47b7e8/mcs/class/System.Core/System.Linq/Enumerable.cs:2120
  4.   at System.Linq.QuickSort`1[UnityEngine.RaycastHit]..ctor (IEnumerable`1 source, System.Linq.SortContext`1 context) [0x00006] in /Applications/buildAgent/work/51c26656ff47b7e8/mcs/class/System.Core/System.Linq/QuickSort.cs:44
  5.   at System.Linq.QuickSort`1+<Sort>c__Iterator21[UnityEngine.RaycastHit].MoveNext () [0x00021] in /Applications/buildAgent/work/51c26656ff47b7e8/mcs/class/System.Core/System.Linq/QuickSort.cs:136
  6.   at System.Collections.Generic.List`1[UnityEngine.RaycastHit].AddEnumerable (IEnumerable`1 enumerable) [0x0001a] in /Applications/buildAgent/work/51c26656ff47b7e8/mcs/class/corlib/System.Collections.Generic/List.cs:125
  7.   at System.Collections.Generic.List`1[UnityEngine.RaycastHit]..ctor (IEnumerable`1 collection) [0x00025] in /Applications/buildAgent/work/51c26656ff47b7e8/mcs/class/corlib/System.Collections.Generic/List.cs:62
  8.   at System.Linq.Enumerable.ToArray[RaycastHit] (IEnumerable`1 source) [0x00029] in /Applications/buildAgent/work/51c26656ff47b7e8/mcs/class/System.Core/System.Linq/Enumerable.cs:2123
  9.   at UICamera.Raycast (Vector3 inPos, UnityEngine.RaycastHit& hit) [0x0010a] in /Users/User/Documents/Unity Projects/MyProject/Assets/NGUI/Scripts/UI/UICamera.cs:427
  10.   at UICamera.ProcessTouches () [0x000dd] in /Users/User/Documents/Unity Projects/MyProject/Assets/NGUI/Scripts/UI/UICamera.cs:889
  11.   at UICamera.Update () [0x0004e] in /Users/User/Documents/Unity Projects/MyProject/Assets/NGUI/Scripts/UI/UICamera.cs:706  


Same thing here...  Dead in the water at the moment :-(

As a side note, we use Linq in lots of places, even with assemblies stripping in place, and have no issues.

Thanks for all your hard work ArenMook! 
Any word on the update with a fix?
Title: Re: Interaction on iOS
Post by: nah0y on November 16, 2012, 01:49:35 AM
Nicki sent me the bug report as well as a fix for it.

Cool, is there a way we can send bug reports ? Didn't knew that!

@masterprompt : the update is live on the Asset Store
Title: Re: Interaction on iOS
Post by: GaVaR on November 12, 2013, 12:11:45 PM
The real problem is in .ToArray() calls.
Each of default generic system collections have internal IEnumerator<T> implementation, so compiler knows which types will be used to iterate collection.
The other things happens to arrays like T[]. The mscorlib.dll don't have straightforward implementation of generic arrays (only class System.Array), so the
the solution for that is to make custom wrapper extension like that

public static IEnumerable<T> WrapArray(this T[] array);

and use it before each call to Linq.

As I already said, there is no such problem with List<T> or other built-in generic collections.