How do i fix this.. strict typing

i know it has to do with strict typing, but i dont know what to do… for any of them…

'mesh' is not a member of 'UnityEngine.Component'. 
rigidbody' is not a member of 'UnityEngine.Object'. 
'collider' is not a member of 'UnityEngine.Object'. 
'transform' is not a member of 'UnityEngine.Object'.

i need to get this script to compile with unity iphone… it works fine in normal one

Add

as MeshFilter

after your GetComponent(MeshFilter)

Somewhere, you have variables that don’t have

: Rigidbody
: Collider
: Transform

next to them.

Post some actual code if that’s not enough to fix things for you, and I’ll help you out.

Here is the actual code i am having trouble with.

	GetComponent(MeshFilter).mesh = newMesh[Random.Range(0, newMesh.Length) ];
bombClone = Instantiate(iBomb, bombpos, Quaternion.identity);
			bombClone.rigidbody.velocity.y = -bombSpeed;
				Physics.IgnoreCollision(bombClone.collider, invaderClone[iArray[i]].collider);
var lifeFlare = Instantiate(extraLife, Vector3(-6 + (extraLives-1)*4, -7, -7.5), Quaternion.identity);
	for (var flaresize = 2.0; flaresize > 0.0; flaresize -= Time.deltaTime) {
		lifeFlare.transform.Rotate(Vector3.forward * Time.deltaTime*50.0);
		lifeFlare.transform.localScale = Vector3(flaresize, flaresize, 1.0);
		yield;
alienClone = Instantiate(alien, other.collider.transform.position, Quaternion.identity);
			alienClone.transform.position.z += 3.0;	
			alienClone.transform.Rotate(-5.0, 0.0, (Random.Range(135.0, 225.0)));
			alienClone.rigidbody.AddRelativeForce (Vector3.up * 1000.0);
Physics.IgnoreCollision(b1.collider, alienClone.collider);
			Physics.IgnoreCollision(b2.collider, alienClone.collider);

all those chucks throw strict typing errors.

(GetComponent(MeshFilter) as MeshFilter).mesh

…as I said above.

var bombClone : GameObject
var lifeFlare : GameObject
var alienClone : GameObject

Instantiate() returns an Object, not a GameObject, so Instantiate() is not enough for the iPhone. You may even need to use
as GameObjectafter the Instantiate function arguments, though I’m not sure about that without looking. Let us know here if you’d like.

Is there any difference in terms of execution time between the following two coding styles?

	//var lightfollowscript:Follow=GameObject.Find("Spotlight").GetComponent(Follow);
	//var camtrans:Component=GameObject.Find("Main Camera").transform;
	//lightfollowscript.target=camtrans;
	

(GameObject.Find("Spotlight").GetComponent(Follow) as Follow).target=GameObject.Find("Main Camera").transform;

I don’t know if there is any at all, but even if so, that’s not the kind of thing to concern yourself with. The first method is easier to read, and therefore maintain. You’re only using Find() and GetComponent() (.transform is a shortcut for GetComponent(Transform)) one time for each thing you need. There’s no better way to do that unless you can drag things onto variables in the editor, but it’s no big deal unless you need to use the variables later on in the script. In that case, of course the first method is better for performance reasons.