Hi there.
when trying to call this function on the iphone:
function ClampAngle(angle, min, max){
if (target){
if (min < 0) min += 360;
if (angle > 180){
return Mathf.Clamp(angle, min, 360);
} else {
return Mathf.Clamp(angle, 0, max);
}
}
}
I keep getting the following error:
BCE0051: Operator ‘<’ cannot be used with a left hand side of type ‘Object’ and a right hand side of type ‘int’.
This code was put up as an example for the normal version of Unity.
http://forum.unity3d.com/viewtopic.php?t=10871&highlight=limit+rotation
Is there a difference in the way variables have to be passed to functions on the iPhone version?
Define the argument types:
function ClampAngle(angle:float, min:float, max:float){
if (target){
if (min < 0) min += 360;
if (angle > 180){
return Mathf.Clamp(angle, min, 360);
} else {
return Mathf.Clamp(angle, 0, max);
}
}
}
Ok, thanks. But is that a “yes” in that the iPhone DOES require a different syntax than the normal version of unity?
Is this something I need to keep in mind when looking at code examples?
Eric5h5
February 18, 2009, 10:58pm
4
No, but it does require strict typing for speed reasons, which is optional when using Javascript with the normal version. (C# doesn’t have dynamic typing, so this doesn’t affect C# users.)
–Eric
No, but it does require strict typing for speed reasons, which is optional when using Javascript with the normal version. (C# doesn’t have dynamic typing, so this doesn’t affect C# users.)
–Eric
Gotcha. Thanks. I’ll make sure that I keep that in mind when “borrowing” scripts made for the normal version of unity.