I’m having problem with instantiate. There is quite complex gameobject that I would like to copy, but now all of the variables are copied.
foreach (GameObject go in listOfPlayerDroids) {
goCl = (GameObject) GameObject.Instantiate(go);
goCl.tag = currentPlayer;
goCl.layer = LayerMask.NameToLayer("Ignore Raycast");
DroidInternalInterface aaa = goCl.GetComponent<DroidInternalInterface>();
DroidInternalInterface aab = go.GetComponent<DroidInternalInterface>();
foreach(Transform child in goCl.transform)
child.gameObject.layer = LayerMask.NameToLayer("Ignore Raycast");
}
and when I access variables from aaa and aab, they are different (set to 0 on clone).