Is use this line of code alot in regular unity:
var ex1 : Rigidbody = Instantiate(ejectShellPrefab.transform, ejectPoint1.position, ejectPoint1.rotation).rigidbody;
But when i try to complie in Unity iPhone is get a error saying
there is no ‘rigidbody’ on the object the ‘Instantiate’ function is returning.
As a matter of fact i cant do any of these in iphone version:
var objx = Instantiate(…);
var rb = objx.rigidbody; // If object is Rigidbody
or
var pe = objx.particleEmitter; // If object is ParticleEmitter
BUT THESE DO WORK IN NORMAL UNITY
Note: I installed the iphone 1.0.3 (After the unity install)… so i dont get what is the problem.
This is due to the strict typing mechanisms that are enforced in Unity iPhone - it’s a big “gotcha” when coming over from normal Unity using JS.
Putting “#pragma strict” at the top of your scripts will alert you to such typing errors - and this should work for the first line
var ex1 : Rigidbody = Instantiate(ejectShellPrefab.transform, ejectPoint1.position, ejectPoint1.rotation).rigidbody;
becomes…
var ex1Object : GameObject = Instantiate(ejectShellPrefab.transform, ejectPoint1.position, ejectPoint1.rotation);
var ex1: Rigidbody = ex1Object.rigidbody;
Well, that’s one way to do it anyway, you could also do a manual cast using (Rigidbody), or even as Rigidbody.
Or you could make the jump to the stricter world of C# right now, and thank yourself later 
Heck… I am a C# (VisualStudio) programmer by trade. the only reason i am doing this in javascript is because the first few paragraphs of the ‘Scripting’ Tutorial says Javascript is the recommended scripting language.
I would much prefer C#, i am a much string C# (using MS .NET Framework… but have no problem targeting the mono framework)
Thanks for the heads up!
I will switch now before i get too deep into my scripts.
I’m necro-bumping this topic because apparently people are still finding it, but it’s outdated and incorrect since years ago. In Unityscript, Instantiate returns the type of the object being instantiated, not Object, so you don’t need to cast anything manually and it works on iOS the same as “normal” Unity.
–Eric