Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Physics.Contacts GC activity

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

  1. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,591
    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

    anthonov

    Joined:
    Sep 24, 2015
    Posts:
    160
    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