Question by
IanH · Nov 04, 2015 at 09:05 AM ·
gameobjectinstantiatetransform
Parenting Instancing and Prefab issues
Can someone check if this is a bug?
I have instanced two (2) different prefabs with the syntax:
GameObject instanceName = Instantiate (prefabName, position, rotation) as GameObject;
Which SHOULD (I believe) result in two GameObjects which are duplicates of (not references to) two prefabs.
Both objects have complex hierarchies (being animated meshes). E.g. A rifle and a soldier.
When I then run the line
SetParent(childOfInstanceA.transform);
or
transform.parent = childOfInstanceA.transform;
I get the all too familiar error: "Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption".
If this is not a bug, please explain how to fix?
Comment