@@ -256,9 +256,13 @@ public IEnumerator TriggerUpdateTests([Values] OwnerShipMode ownerShipMode, [Val
256
256
AssertOnTimeout ( $ "Timed out waiting for the client-side instance of { GetNetworkAnimatorName ( authoritativeMode ) } to be spawned!") ;
257
257
var animatorTestHelper = ownerShipMode == OwnerShipMode . ClientOwner ? AnimatorTestHelper . ClientSideInstances [ m_ClientNetworkManagers [ 0 ] . LocalClientId ] : AnimatorTestHelper . ServerSideInstance ;
258
258
var layerCount = animatorTestHelper . GetAnimator ( ) . layerCount ;
259
- var animationStateCount = animatorTestHelper . GetAnimatorStateCount ( ) ;
260
259
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 ( ) ;
261
264
Assert . True ( layerCount == animationStateCount , $ "AnimationState count { animationStateCount } does not equal the layer count { layerCount } !") ;
265
+ #endif
262
266
if ( authoritativeMode == AuthoritativeMode . ServerAuth )
263
267
{
264
268
animatorTestHelper = AnimatorTestHelper . ServerSideInstance ;
@@ -304,7 +308,9 @@ public IEnumerator TriggerUpdateTests([Values] OwnerShipMode ownerShipMode, [Val
304
308
// Verify we only entered each state once
305
309
yield return WaitForConditionOrTimeOut ( ( ) => CheckStateEnterCount . AllStatesEnteredMatch ( clientIdList ) ) ;
306
310
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
308
314
// Now, update some states for several seconds to assure the AnimationState count does not grow
309
315
var waitForSeconds = new WaitForSeconds ( 0.25f ) ;
310
316
bool rotateToggle = true ;
@@ -317,7 +323,7 @@ public IEnumerator TriggerUpdateTests([Values] OwnerShipMode ownerShipMode, [Val
317
323
yield return waitForSeconds ;
318
324
rotateToggle = ! rotateToggle ;
319
325
}
320
-
326
+ #endif
321
327
AnimatorTestHelper . IsTriggerTest = false ;
322
328
VerboseDebug ( $ " ------------------ Trigger Test [{ TriggerTest . Iteration } ][{ ownerShipMode } ] Stopping ------------------ ") ;
323
329
}
0 commit comments