Trying to compile to iOS and I’m getting the following exception:
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.
I’ve done my research and I understand that JIT is “Just In Time”, and I need “Ahead Of Time”. I know that it’s to do with the declaration within my line of code. What I want to know is how I can stop the ToArray() throwing an exception and declare the type?
var hitPoints : RaycastHit[] = Physics.RaycastAll(ray, rayLength, layerMask2).OrderBy(function(h){ return h.distance; }).ToArray();