diff --git a/cocos/ui/components/graphics-component.ts b/cocos/ui/components/graphics-component.ts index 6b5a7c7592..4532f52839 100644 --- a/cocos/ui/components/graphics-component.ts +++ b/cocos/ui/components/graphics-component.ts @@ -259,8 +259,6 @@ export class GraphicsComponent extends UIRenderComponent { public onEnable () { super.onEnable(); - this._attachToScene(); - this._activateMaterial(); } @@ -536,8 +534,8 @@ export class GraphicsComponent extends UIRenderComponent { * 根据当前的画线样式,绘制当前或已经存在的路径。 */ public stroke () { - this._attachToScene(); (this._assembler as IAssembler).stroke!(this); + this._attachToScene(); } /** @@ -548,8 +546,8 @@ export class GraphicsComponent extends UIRenderComponent { * 根据当前的画线样式,填充当前或已经存在的路径。 */ public fill () { - this._attachToScene(); (this._assembler as IAssembler).fill!(this); + this._attachToScene(); } /**