Search Unity

UpdateEnvironment readback buffer overflow, please schedule fewer updates.

Discussion in 'Scripting' started by PhoenixAdvanced, Nov 7, 2021.

  1. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    Hi,

    I am currently getting the above warning repeatedly in the console.

    I am using unity 2021.2, and I don't recall seeing this in earlier versions of unity (With the same code) although it is possible that I just didn't notice it.

    The code causing the error is here, and these lines are running inside update:

    surfacematerial.SetColor("_Color1", c2a);
    surfacematerial.SetFloat("_Intensity", scale);

    The weird thing is that I have used setcolor/setfloat inside update in other places, and it is working, so why not here?

    I could look at using invokerepeating to reduce the frequency of the calls, but is there something else I can try first? I would like this code to run as fast as possible, and it seems to work later in the update loop, so I can't see why it causes issues here.

    Thanks for any advice!
     
    AldeRoberge and shinichikudo997 like this.
  2. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    Just an Update:

    These warnings to NOT appear in 2021.1, only in 2021.2, so something must have changed here?
     
    shinichikudo997 likes this.
  3. shinichikudo997

    shinichikudo997

    Joined:
    Jul 1, 2018
    Posts:
    33
    Any update on this?
    How did you find the code responsible for this?
     
  4. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    Hey, yeah, I actually fixed this!

    It wasn't coming from the code I posted above at all, it was coming from the enlighten system.

    I turned off Realtime GI in the lighting settings, and the errors went away.

    I'm not sure exactly why, but I wasn't really using Realtime GI anyway, so it didn't make a difference in my case.
     
    msmoyle, Vog, radiantboy and 2 others like this.
  5. shinichikudo997

    shinichikudo997

    Joined:
    Jul 1, 2018
    Posts:
    33
    Thank you soooooooooooooooooooooooooooo much for the reply. This really solved my problem and for some reason i no longer need my created light settings either.
    I remember last time i made it because Unity called it None.
    But once again so many thnaks :D
     
    PhoenixAdvanced likes this.
  6. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    Haha, no problem! It took me a while to find, I'm glad I could help!
     
    shinichikudo997 likes this.
  7. luvcraft

    luvcraft

    Joined:
    Aug 22, 2011
    Posts:
    74
    This mostly helped me, too; with Realtime GI turned off in Lighting Settings I no longer get that warning multiple times per second. However, I have a "fast forward" mechanic where the day / night cycle goes faster, and when that happens I DO see the warning again.

    I tried setting
    DynamicGI.updateThreshold = 10;
    , but that didn't help. Any other suggestions?
     
    Marc-Saubion likes this.
  8. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    How are you implementing the Day/night cycle? Do you have code examples?
     
  9. luvcraft

    luvcraft

    Joined:
    Aug 22, 2011
    Posts:
    74
    Fixed it! Even though I'd turned off Realtime GI, Realtime Environment lighting was still true, even though it's grayed out in the Lighting Settings and appears to change there along with Realtime GI. I opened the lighting settings in a text editor and set
    m_RealtimeEnvironmentLighting: 0
    , and now I'm not seeing the warning anymore!
     
    nekowei likes this.
  10. luvcraft

    luvcraft

    Joined:
    Aug 22, 2011
    Posts:
    74
    I can even turn realtime GI back on and as long as realtime environment lighting is false I don't see the warning! Hooray!
     
  11. luvcraft

    luvcraft

    Joined:
    Aug 22, 2011
    Posts:
    74
    oh wait, with Realtime GI on I DO still get the warning when I fast-forward time, but not when time is going at normal speed (24 minute days).
     
  12. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    That's great, I'm glad you fixed it!
     
    luvcraft likes this.
  13. alti

    alti

    Joined:
    Jan 8, 2014
    Posts:
    94
    This happens when the light you're using for baked materials is moved during runtime, or when it is a child object of a parent that is moving. If it's moving during runtime, you'll get this warning and the only way to stop seeing it is to remove realtime global illumination, as suggested. If you want Realtime Global Illumination, your light cannot move.
     
    PhoenixAdvanced likes this.
  14. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    Ah! That makes sense! That is what I was doing! Thanks for clearing that up!
     
  15. atr0phy

    atr0phy

    Joined:
    Nov 5, 2014
    Posts:
    43
    Disabling GI entirely isn't what I'd call a fix, per se. It's more of an "out of sight out of mind" kinda thing.

    I'm getting that warning when moving a light but not during runtime.
     
  16. TheQuantumWanderer

    TheQuantumWanderer

    Joined:
    Nov 10, 2017
    Posts:
    5
    This error message only appears if you change a variable too quickly (overflow) if you reduce the frequency it no longer appears.
    If you change a value with your mouse too quickly on a slider in editor windows this also happens, if you move the cursor more slowly it no longer appears.
     
    BaraShiro and PhoenixAdvanced like this.