- Home /
Question by
hellaandrew · Jun 20, 2015 at 07:37 PM ·
instantiateprefabposition
Why are the children of the prefab I am instantiating getting the same exact transforms of its parent?
Before I explain what's going on, let me tell you what I have.
A prefab which has a child
The child object has an animator object on it
The prefab is saved with its Transforms all zero'd out (except for scale, of course).
The problem I am experiencing is that whenever I instantiate that gameObject in a certain position, it's child will show the same exact opposite transforms. Visually, the object always looks like it is in the 0, 0, 0 of the world.
This is the code I use to instantiate the object:
GameObject raptor = (GameObject) Instantiate( raptors[ randomNumber ], spawnPoint, Quaternion.identity );
raptor.transform.parent = gameObject.transform;
Here are some screenshots to help illustrate:
I need the parent prefab (Raptor_B(Clone)) I am instantiating to be in the position I need it at with it's child object (Raptor) staying at 0, 0, 0 (local).
Any ideas on why this is happening? Thanks
screenshot-2015-06-20-122503.png
(28.2 kB)
screenshot-2015-06-20-122509.png
(33.9 kB)
Comment