@@ -256,9 +256,13 @@ public IEnumerator TriggerUpdateTests([Values] OwnerShipMode ownerShipMode, [Val
256256 AssertOnTimeout ( $ "Timed out waiting for the client-side instance of { GetNetworkAnimatorName ( authoritativeMode ) } to be spawned!") ;
257257 var animatorTestHelper = ownerShipMode == OwnerShipMode . ClientOwner ? AnimatorTestHelper . ClientSideInstances [ m_ClientNetworkManagers [ 0 ] . LocalClientId ] : AnimatorTestHelper . ServerSideInstance ;
258258 var layerCount = animatorTestHelper . GetAnimator ( ) . layerCount ;
259- var animationStateCount = animatorTestHelper . GetAnimatorStateCount ( ) ;
260259
260+ // Since the com.unity.netcode.components does not allow test project to access its internals
261+ // during runtime, this is only used when running test runner from within the editor
262+ #if UNITY_EDITOR
263+ var animationStateCount = animatorTestHelper . GetAnimatorStateCount ( ) ;
261264 Assert . True ( layerCount == animationStateCount , $ "AnimationState count { animationStateCount } does not equal the layer count { layerCount } !") ;
265+ #endif
262266 if ( authoritativeMode == AuthoritativeMode . ServerAuth )
263267 {
264268 animatorTestHelper = AnimatorTestHelper . ServerSideInstance ;
@@ -304,7 +308,9 @@ public IEnumerator TriggerUpdateTests([Values] OwnerShipMode ownerShipMode, [Val
304308 // Verify we only entered each state once
305309 yield return WaitForConditionOrTimeOut ( ( ) => CheckStateEnterCount . AllStatesEnteredMatch ( clientIdList ) ) ;
306310 AssertOnTimeout ( $ "Timed out waiting for all states entered to match!") ;
307-
311+ // Since the com.unity.netcode.components does not allow test project to access its internals
312+ // during runtime, this is only used when running test runner from within the editor
313+ #if UNITY_EDITOR
308314 // Now, update some states for several seconds to assure the AnimationState count does not grow
309315 var waitForSeconds = new WaitForSeconds ( 0.25f ) ;
310316 bool rotateToggle = true ;
@@ -317,7 +323,7 @@ public IEnumerator TriggerUpdateTests([Values] OwnerShipMode ownerShipMode, [Val
317323 yield return waitForSeconds ;
318324 rotateToggle = ! rotateToggle ;
319325 }
320-
326+ #endif
321327 AnimatorTestHelper . IsTriggerTest = false ;
322328 VerboseDebug ( $ " ------------------ Trigger Test [{ TriggerTest . Iteration } ][{ ownerShipMode } ] Stopping ------------------ ") ;
323329 }
0 commit comments