No instantiate?

hey…

so im basicly trying to use a simple press GUI, instantiate missile code… heres what i have.

var cratePrefab:Transform;



function OnGUI () {
if (GUI.Button (Rect (50,50,80,20), "Shoot"))
{
 var crate = Instantiate(cratePrefab, transform.position, transform.rotation);
 
 crate.rigidbody.AddForce(transform.forward *10000);
}


}

it works fine when i just click play, but when i build it to the phone i get an error saying my scripts have compiler errors, it exports for standalone just fine, its only for the phone.

after picking it apart, and running some other tests, it seems instantiate is the issue. any help here?

any other way to achieve the same result?

the iphone has no dynamic typing. if you don’t declare crate as a type it will be of type UnityEngine.Object (what instantiate returns) in which case it does not offer any of the game object functionality.

there are like 5 dozen threads on the matter