glTFast
glTFast copied to clipboard
GLTF Shaders are using too much space in ram
Hello, i have a project where i need to import glb files in runtime. I need all shader variants (at least that is what i think) so i included those in the build. I took a memory snapshot using Unity Memory Profiler, this snapshot belongs to a standalone build. I am not sure if this is a bug, is there anything i can do to decrease this ram usage?
string[] tmp_ShaderNames =
{
"glTF-pbrMetallicRoughness",
"glTF-pbrMetallicRoughness-Opaque",
"glTF-pbrSpecularGlossiness",
"glTF-pbrSpecularGlossiness-Opaque",
"glTF-pbrSpecularGlossiness-Blend",
"glTF-unlit",
"glTF-pbrMetallicRoughness-Blend",
};
foreach (string tmp_ShaderName in tmp_ShaderNames)
{
var tmp_Shader = Shader.Find($"Shader Graphs/{tmp_ShaderName}");
if (tmp_Shader)
Resources.UnloadAsset(tmp_Shader);
}
Try this code this release the shaders.
We have the same problem on our project, and I'm afraid that releasing it is not the solution. Is there any statement from the developers? If native memory is allocated by 1.02GB, and two shaders need 0.8GB, it is more than suspicious :\