Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta 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:
    5,379
    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.
     
unityunity