fix: mtt-4516 NetworkList change inside OnNetworkSpawn#2181
Merged
jeffreyrainy merged 3 commits intodevelopfrom Sep 8, 2022
Merged
fix: mtt-4516 NetworkList change inside OnNetworkSpawn#2181jeffreyrainy merged 3 commits intodevelopfrom
jeffreyrainy merged 3 commits intodevelopfrom
Conversation
…ls short as the NetworkBehaviour doesn't yet have its NetworkVariables initialized
…NetworkVariable upon spawn, as it is the logical place to do so
ShadauxCat
reviewed
Sep 7, 2022
| public class NetworkList<T> : NetworkVariableBase where T : unmanaged, IEquatable<T> | ||
| { | ||
| private NativeList<T> m_List = new NativeList<T>(64, Allocator.Persistent); | ||
| private NativeList<T> m_ListAtLastReset = new NativeList<T>(64, Allocator.Persistent); |
Collaborator
There was a problem hiding this comment.
Glad to see this not be needed anymore. Good work finding a better solution! 🥳 🎉
ShadauxCat
approved these changes
Sep 7, 2022
jakobbbb
pushed a commit
to GooseGirlGames/com.unity.netcode.gameobjects
that referenced
this pull request
Feb 22, 2023
…ogies#2181) * fix: Marking NetworkVariable dirty upon spawn on the host/server. Falls short as the NetworkBehaviour doesn't yet have its NetworkVariables initialized * fix: clearing variable dirty state post spawning. Also, Initializing NetworkVariable upon spawn, as it is the logical place to do so * test: tests and removing debug logging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
changes to the NetworkList inside OnNetworkSpawn results in other clients not catching the change of the values
mtt-4516
#2163
This removes the hack that was need for NetworkList:
ListAtLastReset. This hack was needed because the order of operations differed between in-scene placed objects and dynamically spawned object. However, the flow is now the same.However, fixing this exposed another issue. Upon modifying a NetworkList during spawning, even though the correct list would now be sent, the modify operation would be re-applied at the next modification. So, we added a clear of the dirty state of NetworkVariables upon spawn, on the server.