Here’s the problem. I want to get variables from cloned object script, but instead i get variables of prefab’s script. Code:
public GameObject prefab;
public Script script;
public int value;
void Start () {
GameObject clone =(GameObject)Instantiate (prefab, transform.position, transform.rotation);
script=(Script)clone.GetComponent<Script>();
value=script.variable;
}
Editor indicates, that script indicates as [Prefab(Clone) (Script)], that means it refered to cloned object.