- Home /
ExecutionEngineException: Unity 3 on the iPhone
Hello all,
I am having some weird behavior in my game when it is running on a device. The game works just fine when it is running inside of the editor with UnityRemote. However, when I build and run the game on the iPad it starts fine and then when it gets to this one function, I get this error in the Xcode console:
ExecutionEngineException: Attempting to JIT compile method '(wrapper dynamic-method) Boo.Lang.Runtime.RuntimeServices:RuntimeServices$op_Addition$System.String$UnityEngine.Vector3 (object,object[])' while running with --aot-only.
at System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, Boolean throwOnBindFailure) [0x00000] in <filename unknown>:0 at System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method, Boolean throwOnBindFailure) [0x00000] in <filename unknown>:0 at System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method) [0x00000] in <filename unknown>:0 at System.Reflection.Emit.DynamicMethod.CreateDelegate (System.Type delegateType) [0x00000] in <filename unknown>:0 at Boo.Lang.Runtime.DynamicDispatching.Emitters.DispatcherEmitter.CreateMethodDispatcher () [0x00000] in <filename unknown>:0 at Boo.Lang.Runtime.DynamicDispatching.Emitters.DispatcherEmitter.Emit () [0x00000] in <filename unknown>:0 at Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.EmitMethodDispatcher (Boo.Lang.Runtime.CandidateMethod found, System.Type[] argumentTypes) [0x00000] in <filename unknown>:0 at Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.Create () [0x00000] in <filename unknown>:0 at Boo.Lang.Runtime.RuntimeServices.DoCreateMethodDispatcher (System.Object target, System.Type targetType, System.String name, System.Object[] args) [0x00000] in <filename unknown>:0 at Boo.Lang.Runtime.RuntimeServices.CreateMethodDispatcher (System.Object target, System.String name, System.Object[] args) [0x00000] in <filename unknown>:0 at Boo.Lang.Runtime.RuntimeServices+<Invoke>c_AnonStorey13.<>m_7 () [0x00000] in <filename unknown>:0 at Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) [0x00000] in <filename unknown>:0 at Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) [0x00000] in <filename unknown>:0 at Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) [0x00000] in <filename unknown>:0 at Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args) [0x00000] in <filename unknown>:0 at Boo.Lang.Runtime.RuntimeServices.InvokeRuntimeServicesOperator (System.String operatorName, System.Object[] args) [0x00000] in <filename unknown>:0 at Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator (System.String operatorName, System.Object lhs, System.Object rhs) [0x00000] in <filename unknown>:0 at CustomTapControl.BlockControl () [0x00000] in <filename unknown>:0 at CustomTapControl.Update () [0x00000] in <filename unknown>:0
(Filename: Line: -1)
Here is the BlockControl function that it mentions in the error.
function BlockControl() { var hitPoint;
var count : int = iPhoneInput.touchCount;
if( count == 1 && state == ControlState.MovingBlock ) { var touch : iPhoneTouch = iPhoneInput.GetTouch(0); var screenRay = cam.ScreenPointToRay( Vector3( touch.position.x, touch.position.y ) );
var touchHit : RaycastHit;
if( Physics.Raycast(screenRay, touchHit, 10000, touchLayerMask) )
{
hitPoint = touchHit.point;
var movementVector : Vector3;
if(latchedBlock.transform.position.x != latchedBlock.transform.parent.transform.position.x)
{
if(hitPoint.x > latchedBlock.transform.parent.transform.position.x)
{
movementVector = Vector3(1,0,0);
}
else
{
movementVector = Vector3(-1,0,0);
}
}
else if(latchedBlock.transform.position.z != latchedBlock.transform.parent.transform.position.z)
{
if(hitPoint.z > latchedBlock.transform.parent.transform.position.z)
{
movementVector = Vector3(0,0,1);
}
else
{
movementVector = Vector3(0,0,-1);
}
}
if(latchedBlock != null)
{
var ray : Ray;
ray.origin = latchedBlock.transform.parent.transform.position;
ray.direction = movementVector;
var hit : RaycastHit;
if (Physics.Raycast (ray, hit, 100, freeSpaceMask)) {
startBlockTransform = latchedBlock.transform.parent.transform;
targetTransform = hit.transform;
state = ControlState.WaitingForBlockMovement;
}
}
}
} }
I am using Unity 3.0.0f4 iPhone Basic. I have tried .NET 2.0 Subset and regular .NET 2.0. Also, I have tried armv7 and v6 and then just armv6 only. I have a feeling that the problem is the way that I am constructing a Vector3 object, but I really have no idea. Any help is greatly appreciated.
Answer by Peter G · Sep 27, 2010 at 12:34 AM
You have to explicitly state the type of your variables. The standalone let's unity use dynamic typing, but everything has to be statically typed in iPhone. The first example I see is:
var hitPoint;
so change that to:
var hitPoint : Vector2;
and any other examples like that, and you should be good to go.
Answer by Dreamora · Sep 27, 2010 at 12:52 AM
aside of that the code just has errors. you have a Vector3( ... ) in the raycast function but only provide 2 values and things like that.
Unity iPhone 1.7 and mono 1.2.5 were much more forgiving on broken code. Good thing is that getting errors thrown right out will help you write correct code in the first place
also, adding
#pragma strict
#pragma implicit
#pragma downcast
at the top of each unitscript file can save you quite a bit of time cause errors will appear then in the editor normally not post build on the device.
Your answer
Follow this Question
Related Questions
How to support Retina display 1 Answer
How do I invert the Y axis in Penelope tutorial? 3 Answers
A node in a childnode? 1 Answer
Make objects easier to select 1 Answer
Unity iPhone and Unity Desktop Scripting Differences 2 Answers