@@ -148,6 +148,10 @@ public IEnumerator NetworkTransformParentingLocalSpaceOffsetTests([Values] Trans
148148 yield return null ;
149149 }
150150
151+ /// <summary>
152+ /// Moves and rotates the authority side with a single frame between
153+ /// both actions in order to
154+ /// </summary>
151155 private IEnumerator MoveAndRotateAuthority ( Vector3 position , Vector3 rotation )
152156 {
153157 m_AuthoritativeTransform . transform . position = position ;
@@ -179,30 +183,40 @@ private IEnumerator WaitForPositionAndRotationToMatch(int ticksToWait)
179183 $ "Authority ({ m_AuthoritativeTransform . transform . rotation . eulerAngles } ) Non-Authority ({ m_NonAuthoritativeTransform . transform . rotation . eulerAngles } )") ;
180184 }
181185
182- [ UnityTest ]
183- public IEnumerator NetworkTransformMultipleChangesOverTime ( [ Values ] TransformSpace testLocalTransform , [ Values ] OverrideState overideState )
186+ private IEnumerator WaitForNextTick ( )
184187 {
185- var overrideUpdate = overideState == OverrideState . CommitToTransform ;
186- m_AuthoritativeTransform . InLocalSpace = testLocalTransform == TransformSpace . Local ;
187-
188- // Wait for tick to change (so we start close to the beginning the next tick)
189188 var currentTick = m_AuthoritativeTransform . NetworkManager . LocalTime . Tick ;
190189 while ( m_AuthoritativeTransform . NetworkManager . LocalTime . Tick == currentTick )
191190 {
192191 yield return null ;
193192 }
193+ }
194+
195+ [ UnityTest ]
196+ public IEnumerator NetworkTransformMultipleChangesOverTime ( [ Values ] TransformSpace testLocalTransform , [ Values ] OverrideState overideState )
197+ {
198+ var overrideUpdate = overideState == OverrideState . CommitToTransform ;
199+ m_AuthoritativeTransform . InLocalSpace = testLocalTransform == TransformSpace . Local ;
194200
195201 var positionStart = new Vector3 ( 1.0f , 0.5f , 2.0f ) ;
196202 var rotationStart = new Vector3 ( 0.0f , 45.0f , 0.0f ) ;
197203 var position = positionStart ;
198204 var rotation = rotationStart ;
205+
199206 // Move and rotate within the same tick, validate the non-authoritative instance updates
200207 // to each set of changes. Repeat several times.
201208 for ( int i = 1 ; i < m_PositionRotationIterations + 1 ; i ++ )
202209 {
203210 position = positionStart * i ;
204211 rotation = rotationStart * i ;
212+ // Wait for tick to change so we cam start close to the beginning the next tick in order
213+ // to apply both deltas within the same tick period.
214+ yield return WaitForNextTick ( ) ;
215+
216+ // Apply deltas
205217 MoveAndRotateAuthority ( position , rotation ) ;
218+
219+ // Wait for deltas to synchronize on non-authoritative side
206220 yield return WaitForPositionAndRotationToMatch ( 4 ) ;
207221 }
208222
@@ -211,23 +225,35 @@ public IEnumerator NetworkTransformMultipleChangesOverTime([Values] TransformSpa
211225 {
212226 position = positionStart * i ;
213227 rotation = rotationStart * i ;
228+ // Wait for tick to change so we cam start close to the beginning the next tick in order
229+ // to apply both deltas within the same tick period.
230+ yield return WaitForNextTick ( ) ;
231+
214232 MoveAndRotateAuthority ( position , rotation ) ;
215233 yield return WaitForPositionAndRotationToMatch ( 4 ) ;
216234 }
217235
236+ // Wait for tick to change so we cam start close to the beginning the next tick in order
237+ // to apply as many deltas within the same tick period as we can (if not all)
238+ yield return WaitForNextTick ( ) ;
239+
218240 // Move and rotate within the same tick several times, then validate the non-authoritative
219241 // instance updates to the authoritative instance's final position and rotation.
220242 for ( int i = 1 ; i < m_PositionRotationIterations + 1 ; i ++ )
221243 {
222244 position = positionStart * i ;
223245 rotation = rotationStart * i ;
224- MoveAndRotateAuthority ( position , rotation ) ;
225246
247+ MoveAndRotateAuthority ( position , rotation ) ;
226248 }
227249
228250 yield return WaitForPositionAndRotationToMatch ( 1 ) ;
229251
230- // Repeat this in the opposite direction
252+ // Wait for tick to change so we cam start close to the beginning the next tick in order
253+ // to apply as many deltas within the same tick period as we can (if not all)
254+ yield return WaitForNextTick ( ) ;
255+
256+ // Repeat this in the opposite direction and rotation
231257 for ( int i = - 1 ; i > - 1 * ( m_PositionRotationIterations + 1 ) ; i -- )
232258 {
233259 position = positionStart * i ;
@@ -237,8 +263,6 @@ public IEnumerator NetworkTransformMultipleChangesOverTime([Values] TransformSpa
237263 yield return WaitForPositionAndRotationToMatch ( 1 ) ;
238264 }
239265
240-
241-
242266 /// <summary>
243267 /// Tests changing all axial values one at a time.
244268 /// These tests are performed:
0 commit comments