creator 3.6 mask 如何设置Graphics

2.x中可以通过this.node.getComponent(Mask)[’_graphics’]
3.x中是如何获取呢?

在3.6中mask被分为了MASK和Graphics两个组件

文档中


是这样被定义调用的,可源码中mask没有graphics的定义,导致调用出错

解决了直接修改Graphics组件内容就可以,

你好,可以看下这里完整的代码吗? g = mask.graphics 是报错的,且直接在代码start里画一个graphics会报错this.graphics为null this.graphics = this.getComponent(Graphics);
console.log(‘this.graphics’, this.graphics);
this.graphics.lineWidth = 1;
this.graphics.strokeColor.fromHEX(’#000000’);
this.graphics.fillColor.fromHEX(’#370453’);
this.graphics.roundRect(-120, -15, 240, 32, 15);