Problem with Arguments in Unity3D/iPhone

This code works within standard Unity3D, but not in the iPhone version.
The result should be 20.


function Update () {
PrintParameter(10);
}

function PrintParameter(arg)
{
argB = arg+arg;
print(argB);
}

Assets/Scripts/iPhone Test Scripts.js(8,19): BCE0051: Operator ‘+’ cannot be used with a left hand side of type ‘Object’ and a right hand side of type ‘Object’.

-------------------- arg is an Object not a parameter?

Can you please apply here a complet code sample which works also in the iPhone version of Unity3D?

Many thanks

You can’t use dynamic typing with the iPhone.

–Eric

...
PrintParameter(10); 
} 

function PrintParameter(arg : int) 
{ 
var argB : int = arg + arg; 
print(argB); 
}

That should work.

just a quick question on this point, in order to produce scripts that one day might be re-used in an iPhone app, (and not having unity iPhone currently to get access to the documentation) is it correct to say that if you are using #pragma strict in javascript scripts, then the resulting strict typing will be compatible with iPhone compiling?

cheers

Exactly, using #pragma strict is recommended.

Yep.

–Eric