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
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.
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.