Search Unity

The questions just keep coming!

Discussion in 'Editor & General Support' started by FancyPants, Jul 5, 2005.

  1. FancyPants

    FancyPants

    Joined:
    Jun 30, 2005
    Posts:
    38
    This is a two-parter.

    First part, I know that there is the functions for getting a game objects children by the index, I was wondering if there were any undocumented functions for getting them by name, for example, or if there is another way of doing it by name?

    Also, when importing a blender scene, I always get this stray box in the mesh that isn't there in blender. Any idea what's up with that?

    Thanks,
    --Thomas
     
  2. David-Helgason

    David-Helgason

    Moderator

    Joined:
    Mar 29, 2005
    Posts:
    1,104
    O, the stray box. I think it's the default scene that contains the box which then always shows up when you export. I'm no blender specialist, but somehow you supposedly can remove it from the default scene.

    Nicholas knows. Nich, can you assist? This should probably go in the docs too (if it isn't there already)

    d.
     
  3. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    In 1.0.1 you can iterate through the children like this:

    Code (csharp):
    1.  
    2. for (child in transform)
    3. {
    4.    if (child.name == "thename")
    5.    {
    6.      
    7.    }
    8. }
    9.  


    In 1.0.2 you can use FindChild (string name); which will also search hiearchies if you use the '/' character.

    Code (csharp):
    1.  
    2. thetransform = transform.FindChild ("thename");
    3.