x


MissingMethodException: Method not found: 'System.Single.op_LessThanOrEqual'.

I seem to be unable to use the "less than or equal to" operator correctly, and was hoping someone would be able to tell me what I'm doing wrong in my use of it?

if (dist 

The above code compiles and runs but generates this error in the debug console. I suspect the first line is the important part.

MissingMethodException: Method not found: 'System.Single.op_LessThanOrEqual'.
Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.ProduceExtensionDispatcher ()
Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.Create ()
Boo.Lang.Runtime.RuntimeServices.DoCreateMethodDispatcher (System.Object target, System.Type targetType, System.String name, System.Object[] args)
Boo.Lang.Runtime.RuntimeServices.CreateMethodDispatcher (System.Object target, System.String name, System.Object[] args)
Boo.Lang.Runtime.RuntimeServices+c__AnonStorey12.m__6 ()
Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object[] args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args)
Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator (System.String operatorName, System.Object lhs, System.Object rhs)
Rethrow as MissingMethodException: Less than or equal is not applicable to operands 'System.Single' and 'UnityEngine.Vector3'.
Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator (System.String operatorName, System.Object lhs, System.Object rhs)
RigidbodyMovement_v2.FixedUpdate () (at Assets/RigidbodyMovement_v2.js:29)
more ▼

asked Jan 17 '12 at 08:41 PM

Sastrei gravatar image

Sastrei
1 2 3 4

It would be interesting what type "dist" and "distancefromtarget" has... It's most likely one or both are not a simple type do not implement this operator. We need to see where those two variable are declared.

Jan 17 '12 at 08:43 PM Bunny83

Neither one is typed (set using :?). They're declared outside of any functions at the top of the script.

Jan 18 '12 at 05:40 PM Sastrei

That's the problem! Unity was not able to define which type they are at runtime, and produced that error. Define both as floats:

var dist; float;
var distanceFromTarget: float;

Maybe you have other errors after fixing this one - if so, let us know!

Jan 18 '12 at 07:08 PM aldonaletto

The error seems to have gone away now, many thanks!

Jan 19 '12 at 06:05 AM Sastrei
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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:

x39
x14

asked: Jan 17 '12 at 08:41 PM

Seen: 799 times

Last Updated: Jan 19 '12 at 06:05 AM