Unity - Remember the problem that some mobile phones are stuck due to compatibility brought about by unofficial variant optimization


question

On April 6, 2023, our character display interface encountered a Huawei mobile phone, and on the red mi note 11 test mobile phone, we
encountered similar problems again on May 24, 2023, but this time there are many places to reproduce, not only the character display interface encountered arrive


But I have consulted the company's TA boss - 2023.4.6

insert image description here


Then consult the unity technical official - 2023.4.6

insert image description here


Stuck again - 2023.5.24

Excluded:

  • Model
  • special effects
  • Scenes
  • figure
  • material

After many investigations, it was found that all the variant split optimization files of PBR caused the stuck problem caused by the shadow part
(for the way of variant split file optimization, you can check my previous article: UBer Shader split into #define + multiple shader optimization practice results with a small amount of #multi_compile )

Recall my previous screenshot of 2023.4.6: alsorelated to shadow, but at that time did not do PBR shader variant split
insert image description here


Solution

This part does not need to be split, and it is processed #pragma multi_compile_fwdbasedirectly (but there will be more variants, and a shader found on the real machine will have about 2M larger memory than before )
insert image description here


Specifically, the DEBUG on the real Huawei machine

(Follow-up: On red mi note 11 or Huawei, check the direction of the shader macro on the real machine to locate the macro branch of the shadow and locate the stuck variant branch)

Guess you like

Origin blog.csdn.net/linjf520/article/details/130847540