fix: NetworkAnimator not detecting and synchronizing cross fade initiated transitions#2481
Conversation
Minor updates and cleanup Added additional comments.
| writeSize += FastBufferWriter.GetWriteSize(Layer); | ||
| writeSize += FastBufferWriter.GetWriteSize(Weight); | ||
| BytePacker.WriteValuePacked(writer, Transition); | ||
| BytePacker.WriteValuePacked(writer, CrossFade); |
There was a problem hiding this comment.
Just a note that packing on a bool or byte value is just a passthrough to writer.WriteValueSafe(value). Not anything that needs changing, just wanted to note this in case you were expecting something different.
There was a problem hiding this comment.
Actually, I should make that a single byte with flags... thanks for the call out. 👍
| { | ||
| if (serializer.IsWriter) | ||
| var isWriter = serializer.IsWriter; | ||
| if (isWriter) |
There was a problem hiding this comment.
Just curious but why make this change?
There was a problem hiding this comment.
Good catch! I originally was going to be checking that at other locations but ended up serializing in a way that did not need that. There is no reason for that adjustment and will be committing an update that removes it. 👍
| m_StateFlags |= k_IsTransition; | ||
| } | ||
|
|
||
| if (!writer.TryBeginWrite(writeSize)) |
There was a problem hiding this comment.
This seemed to explicitly want to check it could write the data to error here. Where will it error now for the same condition?
There was a problem hiding this comment.
The primary reason for the switch was due to the added byte packing to reduce bandwidth costs per update (which the size depends upon how well the property is packed)... the remaining serialized properties didn't make sense, processing wise, to do that same pre-calculation so I just ran with safe serialization for everything so that issue is no longer of concern.
This PR resolves the issue where
NetworkAnimatorwas not properly detecting and synchronizing cross fade initiated transitions and not properly synchronizing changes to animation states.It also reduces the cost of each animation state update by packing eligible properties.
Changelog
NetworkAnimatorwas not properly detecting and synchronizing cross fade initiated transitions.NetworkAnimatorwas not properly synchronizing animation state updates.Testing and Documentation