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. Dismiss Notice

Bug Unity 2022.3.7+ crashing / video errors

Discussion in 'Editor & General Support' started by OldManJim76, Sep 9, 2023.

  1. OldManJim76

    OldManJim76

    Joined:
    Sep 21, 2015
    Posts:
    9
    Hi,

    I'm having constant graphic crashes from Unity versions 2022.3.7 / 8 / 9.

    While I'm modifying stuff in the editor, the textures go black & then the video card disconnects, generally crashing Windows.

    It can happen when scaling a model, moving a model, moving an item in the hierarchy. Although I'm just using a few basic Synty assets in the scene, so it's a very minimal number of polys in the scene.

    Sometimes I get the following error at the bottom of the screen: Assertion failed on expression: 'rs && rs->m_Texture && rs->m_SRView':

    IMG_0304.jpg

    Other times I get a popup saying Failed to present D3D11 swapchain due to device reset/removed:

    IMG_0303.jpg

    I have noticed that even in such a basic scene, the video RAM is nearly 11GB on a 12GB RTX 3060 GPU:

    IMG_0305.jpg

    I have tried different video drivers with a clean install using the nVidia removal tool. Deleting the library folder and restarting the project doesn't work.

    I'm at wits end as I can't work on my project due to the constant crashing.

    Does anybody have any ideas?

    Thanks,
    Jim.
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    3,717
    Be sure to use the Nvidia Studio Drivers not Game Ready for creative workflows such as Unity.
    Probably won't fix these issues though. It could as well be a hardware fault. Which isn't unlikely due to the swapchain error bringing down Windows entirely. This indicates the GPU is somehow gone absent, if only for a fraction of a second. Most often this can happen when you wake the computer from standby and then this swapchain error will force the editor to quit - a longstanding driver issue that cannot be fixed by Unity.

    Since this happens to you, and the screen goes blank, and based on my experience it could be a connectivity issue with the monitor, or the monitor itself. So a plug may be lose (try different video ports on PC and monitor), or the cable may be defective (try swapping it), or the monitor itself is causing a disconnect. Or the 3060 is defective or overheating or not getting enough power from the PSU or ...

    But to rule out issues with the editor or the project, close the project and delete the Library folder. Sometimes this fixes some odd issues within a project.

    If that doesn't change anything, try creating a new empty project with the editor version and put your assets in there and try to replicate your workflow. If this doesn't crash ever, it would seem more likely an issue within the current project's contents and settings rather than hardware or drivers.
     
  3. OldManJim76

    OldManJim76

    Joined:
    Sep 21, 2015
    Posts:
    9
    Thanks for the reply, CodeSmile.

    Last night I reinstalled version 2022.3.4 and opened the project in there (without deleting the library folder). So far, I've been running it for a few hours without a single glitch. Also, the GPU is only using around 2GB of RAM.

    My thinking is that there's some kind of GPU memory leak with later versions of 2022.3.

    I'll stick with 2022.3.4 for the time being and see what happens.
     
  4. OldManJim76

    OldManJim76

    Joined:
    Sep 21, 2015
    Posts:
    9
    Quick update...I've been running the project in 2022.3.4 all day without a single crash!
     
  5. VirtualDawn

    VirtualDawn

    Joined:
    Sep 15, 2014
    Posts:
    31
    I ran into this problem as well. Exactly the same thing with same same Unity versions 2022.3.7 / 8 / 9.
    Something is clearly leaking memory and not just GPU memory, RAM as well:

    edit4: Rebuilding library and csproj-files seems to have fixed the problem for me. I can't say for sure my problem was the same as OP, since their problem wasn't fixed by the same method, but I did have exactly the same errors as they:
    - Error messages: "unity crash assertion failed on expression 'rs && rs->m_Texture && rs->m_SRView'"
    - High RAM and VRAM usage leading to displays blinking and going black(and curiously one of my monitors always stayed disconnected until restart) -> Graphics drivers crashed, maybe explorer too.
    - Also the same D3D11 swapchain error after the crash.​

    I did some tests and kept my eye on the RAM and it seems that Unity never clears the ram, it just keeps going up.
    I open my game scene and instantly switch to an empty scene->Game scene RAM is loaded and stable but never clears.
    upload_2023-9-10_14-23-12.png
    ->I open my game scene again->RAM goes up by about the same amount of RAM and stays there
    upload_2023-9-10_14-24-57.png
    ->I open the empty scene again and back to the game scene->Ram goes up A LOT, not sure why.
    upload_2023-9-10_14-25-58.png
    ->I do the same again two more times, first time RAM goes up by ~3.5gb(the scene's amount), and second time by a lot(~double the previous Unity's RAM allocation).
    upload_2023-9-10_14-28-13.png

    -----------------------------------

    I tried creating a new 3d project and see if similar thing happens, but it didn't(I tried putting few custom models in and VFX and ShaderGraph).
    I then tried creating a new 3d URP project, but couldn't get the RAM leak to happen there either. I'll have to investigate the game scene I have and why that particular scene leaks memory... I did some really quick tests:

    I could delete everything else than the player object and still would get that RAM increase just by opening the same scene(without switching to empty one in the middle). So basically I have an empty scene with just a (customised)VR player prefab from VRIF asset in it and I open the same scene by double clicking the scene file and my RAM goes up and up. Never goes down, even if I go to an empty scene and unfocus Unity.
    upload_2023-9-10_14-49-22.png

    I don't have time right now to figure out more than that but will try to do some more tests on this on wednesday if I could find the component responsible.

    edit: I did do couple more tests. First rules out our customisations to the VRIF player prefab, since the memory problem happens with just the default prefab from the asset in an empty scene.

    I also tested OVRCameraRig in an empty scene and the problem didn't happen, at least I think not(edit: On second thought I think it did maybe happen, because in the clean project when I was testing this the RAM usage actually went down between opening scenes and here it never went down). The memory did go up as I opened the same scene continuously, but only by like 50mb at a time and not every time. Compared with the VRIF XR Rig, the RAM goes up by 1.5-2.5gb at a time(but again, not everytime).

    Next step would be to test a new URP project with the BNG VRIF asset and see if the same happens reproducibly there or not. I might not even have the newest version of the asset(though not very old either) I'll get back to this when I can.

    edit2: I can't leeave this here, so that last test:
    1. I updated my VRIF asset and the bug still happened in our porject.
    2a. I tested a new URP project in 2022.3.9f1 and imported newest VRIF asset. I couldn't reproduce the memory leak, so it seems it's something else behind the leak.
    2b. I copied the packageManifest from the buggy project to the new project to see if that produces the bug. It didn't.
    3. I'll do one more thing before I let this rest: Deleting library(and csproj-files) from the buggy project and rebuilding. Hopefully that fixes the bug.

    edit3: Okey, a surprise I'd say: The memory leak went away with rebuilding library and csproj-files!
    I haven't tested very long, but I couldn't get the leak to happen with empty scene+Player or my game scene or even going into play-mode, so for now I'd say the bug is gone!
    I will have to say that deleting library etc and updating the VRIF plugin lead me having to delete another plugin(Feel) and reimporting SteamVR, for (probably unrelated) reasons, which does muddy the waters with the library re-build, but I'd still bet it was that what fixed it.

    edit4: Because my project seems to work now after library rebuild(Unity 2022.3.9f1), I think this memory leak, at least in my case, was caused by the Unity version update process between versions 2022.3.6 and 2022.3.7.

    edit5, the revenge of the edits:
    I've still gotten this bug happen one way(in 2022.3.9f1): building the project.
    When I build it and the process completes, if I don't refocus the unity window, unity keeps hogging memory with fast pace. If I build and immediately focus unity window from the folder that opens, everything is fine and I can play the project from editor and so on. Only if I leave Unity unfocused after building.

    Also, I haven't gotten the bug at all in 2022.3.10f1, so maybe it's fixed? (also the material/texture preview seems to be fixed, hooray!)
     
    Last edited: Sep 28, 2023
  6. newbeevee

    newbeevee

    Joined:
    Jun 8, 2021
    Posts:
    1
    Packaging works fine with version 2022.3.6f1, but when using versions 2022.3.7 to 2022.3.9f1, the game crashes after running for a while.
     
  7. Meatloaf4

    Meatloaf4

    Joined:
    Jul 30, 2013
    Posts:
    181
    Strangely I still seem to be getting this issue on Unity 2022.3.10f1

    [Assert] Assertion failed on expression: 'rs && rs->m_Texture && rs->m_SRView''.

    It's only occuring on android and it occurs after several play mode tests.