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

Destroy function

Discussion in 'Physics' started by danny1111, Nov 24, 2015.

  1. danny1111

    danny1111

    Joined:
    Nov 24, 2015
    Posts:
    5
    In my code, I destroy a cube with the tag "Pick Up". Does this mean that when I print the following line of code (GameObject.FindGameObjectsWithTag("Pick Up").Length), it will equal one less than before or not?
     
  2. Tony-Lovell

    Tony-Lovell

    Joined:
    Jul 14, 2014
    Posts:
    127
    I think Destroy() marks an object for deletion, but it may not be immediately destroyed. Checking right after may not work, then. See DestroyImmediately(), and read its warnings.