I believe that this is a bug because the game engine should compile all combinations of the master material, inside the master material. But it compiles different combinations(which has a non-default static switch parameter), into instances. For example:
It should compile all instances into the master material. But if I alter a static switch parameter in an instance, it recompiles it again in that instance. That’s why now there are extra tens of MB’s of data in my cooked apk.
This is my master material:
Thanks for your report! UE-16031 has already been entered apparently, it’s due to static parameters which are causing the bloat in cooked material instances. This bug is set at a priority 3 and it’s backlogged at this time.
Hey would you be able to make this issue public on issues.unrealengine.com? We’re running into this problem too and would love to track it’s progress.
At this time, UE-16031 cannot be made public. Certain issues have information that we cannot release to the public and this happens to be one of them. Please let me know if you’d like an update in the future.
We are seeing this issue as well. Was this ever resolved?
Is this issue resolved in 4.20 or 4.21?
We are having the same problem in 4.22. Artists used material instances everywhere and now we have over 220MBs of material uassets inside the APK. For reference, textures and lightmap data combined are less than 50MB.
Enabling [shared material shaders and shared material libraries] helped with the problem. Material instances asset size dropped from 2.4MB each to ~300KB. It’s still quite a lot for just a couple of floats, vectors and texture references, but it’s much better.
Testing and Optimizing Your Content | Unreal Engine 5.1 Documentation