proposed fix for issue-542#543
Conversation
- in 4.0.1 the WriteSpawn_Server function in ManagedObjects.Spawning.cs was changed to use WriteNetworkBehaviourId instead of WriteNetworkObjectId. This appends a new byte of data (component index) to the data stream, but the corresponding read was not updated to do the same. This ends up causing parse errors on the client side during spawn events for nested NetworkObjects in certain conditions (specifically, if the nested NetworkObjects' immediate parent is a plain GameObject being used for organizational purposes
|
In v4 NBs are required to be on the object to synchronize parents. Writing NB was likely correct, it's probably the read that is wrong. Checking it out. |
|
Yeah, I did initially try updating the read side but I think I wasn't understanding some edge cases because that caused different errors. May be trivial but just didn't have time to look into it at the time. |
|
I'm working on re-writing the parent spawning stuff considerably but there's a lot of scenarios to test, and some still are not passing. In other words, it's taking longer than expected. Your solution works plenty good for the time being so I'm going to get the PR in and resolve the spawning stuff properly as I go. Especially since I have several other fixes pending release. Thank you for this PR and info! |
- Improved Tugboat.GetPort returns active port after server is started in the scenario listening port is set to 0. - Fixed rare cases of Awake not calling on parent with multiple inheritence levels. - Fixed connections getting duplicate entries in SyncList when values were added on the same tick for connection, before spawn was written. (#505) - Fixed Demos/SceneManager/Additive Scenes/AdditiveScenes_Start missing references. - Fixed NetworkAnimatorEditor not dirtying synchronized parameters when changed inside a prefab. - Fixed NetworkAnimator not always unsubscribing from TimeManager on destroy. (#550) - Added CliemtManager.OnClientTimeOut. - Added ClientManager.LastPacketLocalTick. - Fixed typo in IntermediateLayer.HandleOutgoing method name. - Improved average rollback accuracy by roughly 0.012m. - Improved PredictedObject now warns when trying to use Rigidbody as prediction type while rigidbodies are kinematic. - Changed removed ObserverCondition Clone() and Timed(). - Improved Tugboat.GetPort returns active port after server is started in the scenario listening port is set to 0. - Fixed NetworkTransform.ForceSend not force sending when transform properties were default. - Added NetworkTransform.ForceSend(uint) to force send after a delay. - Fixed several instances of client handling incoming data on despawned objects resulting in harmless warnings. - Improved codegen for Awake initialization to be more reliable and provide better feedback during errors. - Fixed OnClientTimeout not invoking. - Added V3 to V4 upgrade helper menu. - Added code generation to catch mistakes in converting SyncVars from v3 to v4. - Fixed nested objects corrupting spawn packets. (#543) (#542) - Added TimeManager.GetTickAsDouble(byte), GetTickPercentAsByte(byte), GetTickPercentAsDouble(). - Removed TimeManager.GetTickPercent(), replaced with GetTickPercentAsByte().
fixes #542
This PR reverts to previous behavior, because it looked like there are no current paths that read and validate the componentId written by the new WriteNetworkBehaviourId function. This is probably not the correct long-term fix but it was not clear to me how to handle the reader side for all use-cases, or whether that was even necessary. Switching the read side to use ReadNetworkBehaviourId and disregarding the componentId breaks other uses cases, so this seemed the safest short-term thing to do