Fix the problem that addComponent does not check if the same type of component is allowed to exist at the same time (#13916)

This commit is contained in:
bofeng-song
2022-12-27 10:47:10 +08:00
committed by GitHub
parent 9f0cfdc6fe
commit 0aefeaa795
+3 -3
View File
@@ -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