com.unity.netcode.gameobjects
com.unity.netcode.gameobjects copied to clipboard
Transmission problems of networktransform
Description
If NetworkTransform only modifies some attributes (for example, only the x of Pos is modified this time), m_Bitset is not reset after the message is sent, resulting in the sent attributes being sent forever
here would be a hypothetical example:
- We only modify position.x and position.z, but during debugging, we found that in the NetworkTransform.NetworkSerialize method, the value of NetworkTransformState is 942 (except HasRotAngleX and HasRotAngleZ are false) and the rest of the parameters are true, which is incorrect?
Backlog: MTT-4275
Hi @xyxwangkai m_Bitset should only be used to determine which axis is to be checked for deltas above the given threshhold, whether it is in local space or not and things of this nature. It shouldn't impact how often you will be sending updates. What could impact the frequency of when a NetworkTransform will send an update are the "threshold" NetworkTransform properties (i.e. position, rot angle, and scale). As an example, if the position threshold is set to zero then this could possibly make it send every frame.
Could you provide a sample project of the bug you are experiencing? It would greatly help me provide you with assistance or verify this bug?
Hi @NoelStephensUnity I pushed a merge request with a detailed description in the content https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/pull/2100
@xyxwangkai Thank you for taking the time to do this. Let me take a look at your changes.
@xyxwangkai It took me a little bit to make sure I wasn't missing something, but eventually I noticed where the bug was. The easiest way to show you were the changes needed to occur would be via code. Take a look in this branch version of NetworkTransform. The changes I made migrate the threshold delta check inside each axial "sync" check and if it does not exceed the threshold then it resets the bit for that specific axis (for position, rotation, and scale). We don't want to completely reset Bitset as there are other important bits that could be overwritten.
If you have cloned the repository, then you could switch over to that branch (or copy paste that version of NetworkTransform) to see if this resolves the issue you are experiencing?
I think there is another bug already in our ticket system, so I will add this entry to that ticket and create a PR for this fix.
Once again, thank you for taking the time to create the suggested fix! 👍
Cheers,
Noel
Backlog MTT-4275
I am marking this issue as resolved in PR-2170 and should be available in next week's v1.0.2 hot-fix.