Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Instanciate onto a GameObject

Discussion in 'Scripting' started by tfrago01, Nov 30, 2012.

  1. tfrago01

    tfrago01

    Joined:
    Oct 31, 2012
    Posts:
    15
    nooby question here but i was wondering how i use the instantiate function to attach the clone onto a gameObject so that if i move the gameObject i will also move the clones.
     
  2. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    Just set the instantiated object's transform parent property to the transform of the GameObject you wish to attach it to. Along the lines of:

    Code (csharp):
    1.  
    2. newObject.transform.parent = otherObject.transform;
    3.  
     
  3. orktech

    orktech

    Joined:
    Sep 25, 2011
    Posts:
    16