Fix the error when deactive node in onLoad. (#8326)

This commit is contained in:
cary
2021-03-05 19:01:56 +08:00
committed by GitHub
parent 73ffe4916e
commit 0aea3d2bdb
2 changed files with 11 additions and 12 deletions
@@ -80,7 +80,7 @@ function stableRemoveInactive (iterator, flagToClear) {
let next = iterator.i + 1;
while (next < array.length) {
const comp = array[next];
if (comp._enabled && comp.node._activeInHierarchy) {
if (comp.node._activeInHierarchy) {
++next;
} else {
iterator.removeAt(next);
+10 -11
View File
@@ -673,15 +673,6 @@ export class ParticleSystem2D extends Renderable2D {
public declare _renderSpriteFrame: SpriteFrame | null;
public declare _simulator: Simulator;
/**
* @en Play particle in edit mode.
* @zh 在编辑器模式下预览粒子,启用后选中粒子时,粒子将自动播放。
*/
@serializable
@editable
@tooltip('i18n:particle_system.preview')
private preview = true;
/**
* @en If set to true, the particle system will automatically start playing on onLoad.
* @zh 如果设置为 true 运行时会自动发射粒子。
@@ -689,7 +680,7 @@ export class ParticleSystem2D extends Renderable2D {
@serializable
@editable
@tooltip('i18n:particle_system.playOnLoad')
private playOnLoad = true;
public playOnLoad = true;
/**
* @en Indicate whether the owner node will be auto-removed when it has no particles left.
@@ -698,8 +689,16 @@ export class ParticleSystem2D extends Renderable2D {
@serializable
@editable
@tooltip('i18n:particle_system.autoRemoveOnFinish')
private autoRemoveOnFinish = false;
public autoRemoveOnFinish = false;
/**
* @en Play particle in edit mode.
* @zh 在编辑器模式下预览粒子,启用后选中粒子时,粒子将自动播放。
*/
@serializable
@editable
@tooltip('i18n:particle_system.preview')
private preview = true;
@serializable
private _custom = false;
@serializable