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

Getting childrens and nephews?

Discussion in 'Scripting' started by Zathos91, Nov 22, 2014.

  1. Zathos91

    Zathos91

    Joined:
    Aug 26, 2014
    Posts:
    45
    Hi guys, just a quick question

    Can you tell me what's the best and efficient way to get gameobject children and also children of children from the parent with script?
     
  2. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
  3. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,513
    Stoven likes this.
  4. Stoven

    Stoven

    Joined:
    Jul 28, 2014
    Posts:
    171
    @lordofduct is it okay if I use GameObjUtil? It has some pretty handy functionality in there =)
     
  5. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,513
    Yeah, that's what it's on there for.

    All the code on that google code project is available for free on the MIT license.

    http://opensource.org/licenses/mit-license.php

    It's the base of my spacepuppy framework, I have more code in my 'spacepuppy extended' framework that I'm working on releasing on the asset store.
     
    Stoven likes this.
  6. Zathos91

    Zathos91

    Joined:
    Aug 26, 2014
    Posts:
    45
    thanks for the answers :)