From 7fa501ffcbdffcede7bd6aaf966ce61773ad1b56 Mon Sep 17 00:00:00 2001 From: JoneLau <32630749+JoneLau@users.noreply.github.com> Date: Tue, 23 Jun 2020 17:19:06 +0800 Subject: [PATCH] fixed the problem of graphics component scene error when the script is changed (#6922) --- cocos/ui/components/graphics-component.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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(); } /**