Why Cant I Control a Instantiated Object???

Why can I not control “object01” in “ScriptB”? I even tried controlling it in “ScriptA” and still nothing. I have something like this in a pool manager and works fine. But when I try to do this without using a List, it dose not work. Just wondering why?


  public static ScriptA data;

  public GameObject object01;
 void Start()
	data = this;

             object01.SetActive (false);


void MethodCall ()
             		ScriptA.data.object01.transform.position = transform.position;

Try adding:

ScriptA oScript = GetComponant<ScriptA>();

Then you should be able to call the if statement like this:


Basically just change where you have “ScriptA” references in ScriptB to “oScript”.

Never Mind I figured it out:


public GameObject objectA;
public GameObject objectAClone;

objectAClone= Instantiate (objectA) as GameObject;
objectAClone.SetActive (false);

Now I can control the instantiated prefab with “objectAClone”

I think i was referencing the prefab before and not the instantiated object.

Just going to leave this up for others.