change properties of gameObject


Given I can find a single enemy.

q1)will I run into trouble by changing this objects properties here in a script (not attached to it ) after I have accessed the object ? I could now change the position, how it moves, destroy it , disable one of its components etc. Am I getting a copy of this object or a pointer to the object would be how programmer of c++ would ask this question.

q2) to access a list of objects is there another function to use? I might have 10 enemy objects.

private GameObject myenemy;

public class SuperClass : MonoBehaviour // Don't forget to declare a class in C#
    void Start (){		
         myenemy = GameObject.Find ("Enemy");

    // Update is called once per frame
    void Update () {
        myenemy.transform.position = new Vector3(0, 0, 0); 

Short answer, that makes the equivalent of a pointer.

To disable components, you can utilise something akin to…

myEnemy = GameObject.Find("Enemy").GetComponent(BehaviorScript);
myEnemy.enabled = false;

This page lists the basics of adding components etc… But this page (Unity Manual) goes into much more detail about components/linking etc.