From 0aefeaa795bf2b3559e7124630543ffb112adba5 Mon Sep 17 00:00:00 2001 From: bofeng-song Date: Tue, 27 Dec 2022 10:47:10 +0800 Subject: [PATCH] Fix the problem that addComponent does not check if the same type of component is allowed to exist at the same time (#13916) --- cocos/scene-graph/node.jsb.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cocos/scene-graph/node.jsb.ts b/cocos/scene-graph/node.jsb.ts index 5a026e2115..489eae3d90 100644 --- a/cocos/scene-graph/node.jsb.ts +++ b/cocos/scene-graph/node.jsb.ts @@ -181,9 +181,9 @@ nodeProto.addComponent = function (typeOrClassName) { throw TypeError(getError(3810)); } - // if (EDITOR && (constructor as typeof constructor & { _disallowMultiple?: unknown })._disallowMultiple) { - // this._checkMultipleComp!(constructor); - // } + if (EDITOR && (constructor as typeof constructor & { _disallowMultiple?: unknown })._disallowMultiple) { + this._checkMultipleComp!(constructor); + } // check requirement