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. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Physics.Contacts GC activity

Discussion in 'Physics' started by fallFlat, Nov 23, 2015.

  1. MelvMay


    Unity Technologies

    May 24, 2013
    Accessing a GameObject for the first time has GC overhead in the Editor. It's related to the wrapper used. This doesn't happen in builds. It's one of the many differences between Editor and Player Build.

    Maybe deep profiling will reveal what that is though. You could try that.
  2. anthonov


    Sep 24, 2015
    I just tested build player profiling with deep profiling for the first time and, yes it is very different.
    I can see that most of Allocs are from Coroutines yield, Find(), and GetComponents().

    I'm actually profiling a frame where Physics.Contacts leads down to GetComponentsInChildren(), that looks like what triggered these allocs right ?
    Also now I see the big difference with reusing collision callback.
    Capture gc 3.PNG
    Last edited: May 5, 2023