how to instantiate a gameobject as a child code example
Example 1: how to instantiate as child unity
Instantiate(obj, pos, rot, parent);
Example 2: unity instantiate as child
var myNewSmoke = Instantiate (poisonSmoke, Vector3(transform.position.x,transform.position.y, transform.position.z) , Quaternion.identity);
myNewSmoke.transform.parent = gameObject.transform;
Example 3: instantiate gameobject as child
GameObject child = GameObject.Instantiate(MyPrefab);
child.transform.parent = this.gameObject.transform;