Hello,
We have been working on a game (Easy Red 2) for several years and we always managed to make it run with a very good performance, the game is in fact out also on Nintendo switch.
However recently we upgraded unity from 2021.3.3 to 2021.3.25 due to the fact that Nintendo was going to stop accepting submissions with 2021.3.3 soon.
Since the upgrade we noticed some weird issues with VRAM on the build: Apparently VRAM usage now keeps growing constantly until at some point, on some hardware the game will crash.
Interestingly the game normally does crash normally only on RTX cards (also it crashes quite frequently on those cards) and only when the graphic API utilized is Direct X11 or 12, while on other platforms (even with wat way lower specs, like Nintendo switch or pc with integrated gpu) the game doesn’t crash, but it still present weird high VRAM usage. When using Vulkan API the game normally never crashes on any platform, but again VRAM usage is way too high, basically it is always near the maximum VRAM available on the GPU, it can be 1GB or 16GB of vram, it doesn’t matter, the game will use all of it.
We want to emphasize that the game is normally very well optimized and the “memory leak” doesn’t look like it’s coming from the game itself: The game uses usually less than 2GB of RAM at max graphic settings, and we profile frequently the amount of memory used by textures and every graphical aspect and we shouldn’t ever use more than 1.5-2Gb of vram at max graphic settings.
Also we don’t have any issue like creating Textures and never destroying them at runtime, in fact we rarely do that anyway.
We tried to profile the game using the profiler at runtime but we couldn’t see weird memory usage in the game, only using MSI afterburner and game log files after a crash we notice that the VRAM usage was actually constantly growing until reaching max usage and again, eventually crash when using RTX family cards.
We also want to emphasize that the issue started to present very frequently with unity update, but was not there at all on 2021.3.3
What could we do to investigate the VRAM usage even more to find out what can be causing this? At this point we have a doubt that it is an issue related with some errors made by us (neither stuff coming from the very few asset store packages we have), but rather on the engine side expecially after the update.
Btw, we use URP, we use almost only asset bundles to store our assets, and we use almost only custom shaders, but they are very few and lightweight ones.
Thank you for the help