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 have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Bug big string allocations (GC.alloc) appearing inside setup of the URP when using 2 cameras onscreen

Discussion in 'Universal Render Pipeline' started by ameree2, Aug 15, 2023.

  1. ameree2

    ameree2

    Joined:
    May 21, 2018
    Posts:
    9
    I am using 2022.3.7f1 with URP 14.0.8 and am noticing some really odd gc allocs going on when using two cameras on the screen at once. Here's the readout from deep profiling. It seems to be related to the use of string allocations during the setup of the scriptable renderer, and it happens for each of the cameras on every frame. It doesn't happen when I am only using a single camera on screen. I had read about similar issues in older URP releases, but they were reported as resolved by this release.

    for reference, both cameras are active and enabled, but one is an "inset minimap" created by changing its output x,y,w, and h to be in the lower right corner


    upload_2023-8-15_7-23-20.png
     
    Last edited: Aug 15, 2023
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,415
    Maybe make a bug report if no staff responds
     
    ameree2 likes this.
  3. ameree2

    ameree2

    Joined:
    May 21, 2018
    Posts:
    9
    Will do that, just figured I'd also be open to the "you're just doing/interpretting it wrong..." solutions.
     
    DevDunk likes this.
  4. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,415
    I personally don't see why render textures/multiple cameras would require strings to be modified unless your code calls the name or something.
    But I don't work a ton with multiple cameras, so maybe someone else knows more
     
  5. ameree2

    ameree2

    Joined:
    May 21, 2018
    Posts:
    9
    And this is happening deep inside the URP code, so I can't imagine what I'm doing that might trigger that. I was thinking if I were doing something in render textures, or something else that might wind up causing some resetting and allocation somewhere, but strings?!? I wasn't expecting to see that as the culprit.
     
    ununion and DevDunk like this.