之前也有这个问题 以前还用alpha去解决 现在感觉不太行了
demo.mov.zip (1.1 MB)
项目demo
Demo.zip (680.2 KB)
诸位ikun请助我!
ui渲染组件基类UIRenderer会在onEnable时会调用updateMaterial,如果没有设置过customMaterial就会更新为默认材质
https://github.com/cocos/cocos-engine/blob/v3.6.2/cocos/2d/framework/ui-renderer.ts
protected updateMaterial () {
if (this._customMaterial) {
this.setMaterial(this._customMaterial, 0);
return;
}
const mat = this._updateBuiltinMaterial();
this.setMaterial(mat, 0);
if (this.stencilStage === Stage.ENTER_LEVEL || this.stencilStage === Stage.ENTER_LEVEL_INVERTED) {
this.getMaterialInstance(0)!.recompileShaders({ USE_ALPHA_TEST: true });
}
this._updateBlendFunc();
}


