Skip to content

fix: netvar client initialization #1266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ShadauxCat
Copy link
Collaborator

Ensure server netvar initialization in OnNetworkSpawn replicates correctly to clients as initialization and not delta

MTT-1351

Changelog

com.unity.netcode.gameobjects

  • Fixed: Ensure server netvar initialization in OnNetworkSpawn replicates correctly to clients as initialization and not delta

Testing and Documentation

  • Includes integration tests.
  • No documentation changes or additions were necessary.

… correctly to clients as initialization and not delta
@@ -419,7 +419,7 @@ internal void SendSpawnCallForObject(ulong clientId, NetworkObject networkObject

var message = new CreateObjectMessage
{
ObjectInfo = networkObject.GetMessageSceneObject(clientId, false)
ObjectInfo = networkObject.GetMessageSceneObject(clientId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct, just wondering why it was 'false' previously.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was also wondering that, but it definitely seems like it should be true.


namespace TestProject.RuntimeTests
{
public class NetworkVariableInitializationOnNetworkSpawnTest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good, I think I would suggest this could live in NetworkVariableTests. Also in that file you might see you can do the same tests a bit more concisely with the RunAndWaitForCondition helper

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor

@0xFA11 0xFA11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor +1 to Matt's comment but apart from that 🚀

@mattwalsh-unity mattwalsh-unity enabled auto-merge (squash) October 7, 2021 02:26
@mattwalsh-unity mattwalsh-unity merged commit 17320e0 into develop Oct 7, 2021
@mattwalsh-unity mattwalsh-unity deleted the fix/netvar_initialization_in_onnetworkspawn branch October 7, 2021 03:33
mollstam pushed a commit to Keepsake-Games/com.unity.netcode.gameobjects that referenced this pull request Feb 13, 2023
… correctly to clients as initialization and not delta (Unity-Technologies#1266)

Co-authored-by: Matt Walsh <69258106+mattwalsh-unity@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants