Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Scripting benchmark: Destroy << SetActive (false)

Discussion in '5.4 Beta' started by laurentlavigne, Jun 21, 2016.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,221
    1000 go.SetActive(false) is about 4x slower than 1000 Destroy(go)
    Is that expected?

    Off course pooling still represent an advantage when the GO have loads of scripts with inits but I wasn't expecting Destroy to be so fast.
     
  2. ryanbmcm

    ryanbmcm

    Joined:
    Oct 6, 2015
    Posts:
    4
    Just a guess but I believe Destroy just marks an object for being destroyed (unlike DestroyImmediate) so it seems fairly reasonable that doing that would have almost no cost, because it's not actually doing the destroying.