Time.time-dependent behavior not working on actual device

So, here I am with another potentially foolish question:

I’ve got some Time.time-dependent behavior in my game and, though it works perfectly in the editor, it doesn’t work at all on my handset. Here’s what I see in the Xcode console:

ExecutionEngineException: Attempting to JIT compile method '(wrapper dynamic-method) UnityEngine.GameObject:GameObject$GetComponent$System.MonoType (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 iOS_main_and_player.cubeFunction (System.Object cube) [0x00000] in <filename unknown>:0 
  at iOS_main_and_player.Beat () [0x00000] in <filename unknown>:0 
  at iOS_main_and_player.Update () [0x00000] in <filename unknown>:0 
 
(Filename:  Line: -1)

Can anybody decipher that to tell me what’s wrong, or does Time.time act funny on iOS?

My update starts like this:

function Update () {
	if (Time.time >= lastBeat + 0.25) {
		lastBeat = Time.time;
		Beat();
	}
}

And I assign lastBeat as Time.time in Start.

Any ideas?

That works without errors, but it’s more efficient if you use

function Start () {
    InvokeRepeating("Beat", .25, .25);
}

–Eric

oh wow, thanks for letting me know about that function. super useful for my interests within and beyond this project.

i’ll try that and see if it works on my device.

edit: same story. works in editor, not in device. to be clear: the game isn’t crashing or anything…it’s just not doing what i’m expecting.

Works fine here. Deactivate everything, then add stuff back until it stops working, and try to figure out why.

–Eric

found the problem. i feel like a dope.

#pragma downcast and #pragma implicit were fine with this code:

function cubeFunction(cube) {
	cube_script = cube.GetComponent(enq) as enq;

my device totally wasn’t. (cube) needed to be (cube : GameObject), as #pragma strict kindly showed me.