I know there is a lot of of topics about how to Instantiate a prefab as a child of another prefab.
I think I have done right but it still the same error message "
Setting the parent of a transform
which resides in a Prefab Asset is
disabled to prevent data corruption
This is my code :
GameObject answers = panel.panelPrefab.transform.Find("Answers").gameObject; //This prefab is instantiated earlier in the code GameObject goAnswer = Instantiate(answerPrefab, new Vector3(0, 0, 0), Quaternion.identity) as GameObject; goAnswer.transform.SetParent(answers.transform); //Same with goAnswer.transform.parent = answers.transform; //And with goAnswer.GetComponent<Transform>().parent = answers.transform;
I think I’m trying to modify the instance and not the prefab but maybe I’m wrong
So can I Instantiate a prefab as a child of a CLONED prefab or i’m wrong anywhere else ?
Thanks in advance