GameObject p = Instantiate(build, new Vector3(posx,posy+0.525f,posz+0.6f),Quaternion.identity) as GameObject;
GameObject go = Instantiate(Cube_Transform, new Vector3(posx,posy,posz), Quaternion.identity) as GameObject;
How to instantiate object go as a child of object p? Both of them are not present at the scene at once, also they appear through this script at once
GameObject p = Instantiate(build, new Vector3(posx,posy+0.525f,posz+0.6f),Quaternion.identity) as GameObject;
GameObject go = Instantiate(Cube_Transform, new Vector3(posx,posy,posz), Quaternion.identity) as GameObject;
go.transform.parent = p.transform;
An object’s transform has a ‘parent’ variable. Simply go:
go.transform.parent = p.transform;
Try googling or searching the documentation(which is AMAZING) next time.