Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Object exist or not

Discussion in 'Getting Started' started by skeleton-king, Mar 21, 2015.

  1. skeleton-king

    skeleton-king

    Joined:
    Nov 10, 2014
    Posts:
    63
    How to check if object exist in current screen or not.
    I wana spawn a win screen if no win screen currenlty exists in scene
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    GameObject.Find will return null if it can't find the object.
     
  3. knr_

    knr_

    Joined:
    Nov 17, 2012
    Posts:
    258
    It may be better to not spawn the screen, but have it exist already, just have its active flag set to false. Then simply set it to true when you want it to "exist" and false when you need it to "go away".
     
    theANMATOR2b likes this.