Purpose of Destroy()

Forum Archive Purpose of Destroy()

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8805
    Nicholas Yang
    Participant

      I see that Destroy() has a delay of 2f seconds. I tried setting that to 0 and then realized it’s probably to allow the sound to play before the object is destroyed. OK. But then the object is hanging around for 2 seconds after the sound plays. So I see that in GemBounce, this is accounted for by keying MeshRenderer.enabled.

      With MeshRenderer.enabled keyed, what’s the point of having Destroy() here? Just to clear out memory?

      #29389
      Jonathan Gonzalez
      Participant

        Disabling the mesh renderer just ensures it is not rendered on screen. By destroying the game object you remove it entirely from the game and free up the memory it was using. 

      Viewing 2 posts - 1 through 2 (of 2 total)
      • The topic ‘Purpose of Destroy()’ is closed to new replies.