File tree Expand file tree Collapse file tree
com.unity.netcode.gameobjects/Tests/Runtime Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -656,6 +656,7 @@ protected override void OnCreatePlayerPrefab()
656656 private void RandomizeObjectTransformPositions ( GameObject gameObject )
657657 {
658658 var networkObject = gameObject . GetComponent < NetworkObject > ( ) ;
659+ networkObject . InitializeChildNetworkBehaviours ( ) ;
659660 Assert . True ( networkObject . ChildNetworkBehaviours . Count > 0 ) ;
660661
661662 foreach ( var networkTransform in networkObject . NetworkTransforms )
Original file line number Diff line number Diff line change @@ -2650,16 +2650,12 @@ public static void SimulateOneFrame()
26502650 {
26512651 var method = obj . GetType ( ) . GetMethod ( methodName , BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Instance ) ;
26522652 method ? . Invoke ( obj , new object [ ] { } ) ;
2653- if ( obj . ChildNetworkBehaviours == null )
2654- {
2655- obj . InitializeChildNetworkBehaviours ( ) ;
2656- }
2657-
2658- foreach ( var behaviour in obj . ChildNetworkBehaviours )
2659- {
2660- var behaviourMethod = behaviour . GetType ( ) . GetMethod ( methodName , BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Instance ) ;
2661- behaviourMethod ? . Invoke ( behaviour , new object [ ] { } ) ;
2662- }
2653+ }
2654+ var networkBehaviours = FindObjects . ByType < NetworkBehaviour > ( ) ;
2655+ foreach ( var behaviour in networkBehaviours )
2656+ {
2657+ var behaviourMethod = behaviour . GetType ( ) . GetMethod ( methodName , BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Instance ) ;
2658+ behaviourMethod ? . Invoke ( behaviour , new object [ ] { } ) ;
26632659 }
26642660 }
26652661 }
You can’t perform that action at this time.
0 commit comments