- Home /
Question by
JoaoGabrielFL · Aug 31, 2017 at 06:41 PM ·
gameobjectinstantiatechild
instantiate an object without being the child of another
I want to instantiate an object in a specific position defined by another gameobject, but I do not want the instantiated object to be the child of that target object
Comment
Answer by wachief · Aug 31, 2017 at 07:14 PM
you could call Instantiate with parameters
vector3 pos=target.transform.position;
Quaternion rotation=target.transform.rotation;
GameObject ObjectToInstantiate;
Instantiate(ObjectToInstantiate, new pos, rotation);
pos is the position of the target rotation is the rotation of the target (you an also use Quaternion rotation=Quaternion.identity
to set the rotation to the default (0 ,0 ,0) rotation) ObjectToInstantiate is the gameobject that will be Instantiated
this may also help you.