StaticSwitchParamter create too much shadercode.
So It makes cooked game size too much large.
For instance,
There is a Parent_Mat.uasset (with a staticswitchparam bUseEmissive).
And there are Childs
Child1_Mat (bUseEmissive : true)
Child2_Mat (bUseEmissive : false)
Child3_Mat (bUseEmissive : true)
Child4_Mat (bUseEmissive : false)
Child5_Mat (bUseEmissive : true)
And their Cooked asset sizes are,
Parent_Mat : 3MB Cooked asset
Child1_Mat : 3MB Cooked asset
Child2_Mat : 2KB Cooked asset
Child3_Mat : 3MB Cooked asset
Child4_Mat : 2KB Cooked asset
Child5_Mat : 3MB Cooked asset
Because a materialinstance which has enbaled staticswitchparam
caches compiled shader codes individually.
I think below is ideal.
Parent_Mat : 3MB Cooked asset (shader code : bUseEmissive(false))
Child1_Mat : 3MB Cooked asset (shader code : bUseEmissive(true))
Child2_Mat : 2KB Cooked asset (share shader code with Parent)
Child3_Mat : 2KB Cooked asset (share shader code with Child1)
Child4_Mat : 2KB Cooked asset (share shader code with Parent)
Child5_Mat : 2KB Cooked asset (share shader code with Child1)
it there a way to do this???