Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. 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,380
    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,380
    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 :)