Hello! I am new to posting on Unity Answers, though I have been stalking the threads for answers to my problems for quite sometime now…
I am having an issue setting the transform of a game object that I have already instantiated. Now I’ve seen several threads already where people have similar issues, but they are all trying to change the transform of the prefab. I have instantiated the prefab into a variable and I am trying to change the transform of that variable. Here is the bit of code that I am talking about.
var single : GameObject; private var temp:GameObject; temp = GameObject.Instantiate(single, location, single.transform.rotation) as GameObject; temp.transform.parent = transform;
The really frustrating part is that I’m doing this somewhere else in my code (what I believe to be the exact same thing) and it works. This one however…does not.
Also, the exact error I am getting:
“Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption.
Thanks a lot for any help!