Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Calling all game objects

Discussion in 'Scripting' started by BlitheD, Oct 10, 2006.

  1. BlitheD

    BlitheD

    Joined:
    Aug 28, 2006
    Posts:
    36
    I have some objects that I want to call with the GameObject.Find function at runtime. They are in a list with each having some transform being applied to it. However, the game objects can be destroyed at runtime and it seems that if one of the objects higher in the list is destroyed when the GameObject.Find function is called the other objects which still exist are not getting called at all.
    Is there a way to insure that all active objects get called?
    Thanks.
     
  2. freyr

    freyr

    Joined:
    Apr 7, 2005
    Posts:
    1,148
    When destroying a game object, all children are destoyed as well. If you don't want to destroy the childern of a game object you will have to call transform.DetachChildern() before calling Destroy.