fix opacity bug (#8504)

This commit is contained in:
ChiaNing
2021-04-20 18:01:18 +08:00
committed by GitHub
parent d21ee95173
commit 217bc4c4e6
+1 -1
View File
@@ -470,7 +470,7 @@ export class Renderable2D extends RenderableComponent {
protected _updateWorldAlpha () {
const localAlpha = this.color.a / 255;
this.node._uiProps.opacity = this.node.parent ? this.node.parent._uiProps.opacity * localAlpha : localAlpha;
this.node._uiProps.opacity = (this.node.parent && this.node.parent._uiProps) ? this.node.parent._uiProps.opacity * localAlpha : localAlpha;
this._renderFlag = this._canRender();
}