Search Unity

Instantiate children object (Solved)

Discussion in 'Scripting' started by jaxas, Mar 3, 2010.

  1. jaxas

    jaxas

    Joined:
    Mar 22, 2009
    Posts:
    59
    I can't find , how to instantiate object as children of another object. Any suggestion? :?
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Code (csharp):
    1. var ob : GameObject = Instantiate(prefab);
    2. ob.transform.parent = anotherObject.transform;
    --Eric
     
  3. jaxas

    jaxas

    Joined:
    Mar 22, 2009
    Posts:
    59
    Thanks Eric, this is what i needed :wink: