Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. 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,970
    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.