x


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.

more ▼

asked Sep 26 '10 at 09:33 PM

NeilMonday gravatar image

NeilMonday
29 1 1 5

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Sep 27 '10 at 12:34 AM

Peter G gravatar image

Peter G
15k 16 44 136

Thanks, that fixed it.

Oct 03 '10 at 11:49 PM NeilMonday
(comments are locked)
10|3000 characters needed characters left

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.

more ▼

answered Sep 27 '10 at 12:52 AM

Dreamora gravatar image

Dreamora
3.2k 1 4 25

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3748
x3465
x2001

asked: Sep 26 '10 at 09:33 PM

Seen: 2337 times

Last Updated: Sep 26 '10 at 09:33 PM