@@ -645,12 +645,12 @@ export class Entity extends EngineObject {
645
645
activeChangeFlag & ActiveChangeFlag . Hierarchy && ( this . _isActiveInHierarchy = true ) ;
646
646
activeChangeFlag & ActiveChangeFlag . Scene && ( this . _isActiveInScene = true ) ;
647
647
const components = this . _components ;
648
- for ( let i = components . length - 1 ; i >= 0 ; i -- ) {
648
+ for ( let i = 0 , n = components . length ; i < n ; i ++ ) {
649
649
const component = components [ i ] ;
650
650
( component . enabled || ! component . _awoken ) && activeChangedComponents . push ( component ) ;
651
651
}
652
652
const children = this . _children ;
653
- for ( let i = children . length - 1 ; i >= 0 ; i -- ) {
653
+ for ( let i = 0 , n = children . length ; i < n ; i ++ ) {
654
654
const child = children [ i ] ;
655
655
child . isActive && child . _setActiveInHierarchy ( activeChangedComponents , activeChangeFlag ) ;
656
656
}
@@ -660,12 +660,12 @@ export class Entity extends EngineObject {
660
660
activeChangeFlag & ActiveChangeFlag . Hierarchy && ( this . _isActiveInHierarchy = false ) ;
661
661
activeChangeFlag & ActiveChangeFlag . Scene && ( this . _isActiveInScene = false ) ;
662
662
const components = this . _components ;
663
- for ( let i = components . length - 1 ; i >= 0 ; i -- ) {
663
+ for ( let i = 0 , n = components . length ; i < n ; i ++ ) {
664
664
const component = components [ i ] ;
665
665
component . enabled && activeChangedComponents . push ( component ) ;
666
666
}
667
667
const children = this . _children ;
668
- for ( let i = children . length - 1 ; i >= 0 ; i -- ) {
668
+ for ( let i = 0 , n = children . length ; i < n ; i ++ ) {
669
669
const child = children [ i ] ;
670
670
child . isActive && child . _setInActiveInHierarchy ( activeChangedComponents , activeChangeFlag ) ;
671
671
}
0 commit comments