Search Unity

Camera's FireOnPreRender and FireOnPreCull events generate tons of GC Alloc

Discussion in 'Editor & General Support' started by Eudaimonium, Apr 26, 2019.

  1. Eudaimonium

    Eudaimonium

    Joined:
    Dec 22, 2013
    Posts:
    131
    Hi,
    I'm trying to optimize the GC allocations in my project and I've hit a brick wall.

    This is profiled from standalone windows build:
    upload_2019-4-26_14-32-36.png

    There is not a single "OnPreRender" or "OnPreCull" callback in my entire project's solution. The dev scene for testing is relatively simple. I have no idea how to go about optimizing this.

    How do I approach the problem? What is causing these allocations and how do I address this?
     
  2. Eudaimonium

    Eudaimonium

    Joined:
    Dec 22, 2013
    Posts:
    131
    Woops, incorrect.

    GC comes from one of the assets I am using. Working with the developer on resolving this.

    My bad!

    To any moderators: You may remove this thread as there would probably be no constructive discussion from this.
     
    MartinTilo likes this.
  3. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    What asset was it? I too, am having large GC spikes from "Camera.FireOnPreCull()" and it's around 2.4KB.
     
  4. Eudaimonium

    Eudaimonium

    Joined:
    Dec 22, 2013
    Posts:
    131
    It was WeatherMaker in my case. I've since contacted the developer and problem has been fixed (they did some optimization work and there's significantly less GC).
     
  5. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Ok thank you :) I don't use WeatherMaker, so I found out (after a lot of testing) that it was my "DynamicDecals" asset that was causing the GC spikes in my case. That asset is now deprecated, but I was able to find the problem functions thankfully.

    Thanks for your reply.
     
  6. nikescar

    nikescar

    Joined:
    Nov 16, 2011
    Posts:
    165
    I know this was 2 years ago, but do you know which functions they are and how to fix it? Thanks!
     
  7. Eudaimonium

    Eudaimonium

    Joined:
    Dec 22, 2013
    Posts:
    131
    It was an old issue with Weather Maker plugin (highly recommended BTW), which has since been fixed. See post #4.