Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    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,557
    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