-
Notifications
You must be signed in to change notification settings - Fork 450
fix: Fixed NetworkVar assignment of the same value triggering replication #1819
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
Conversation
This was a feature. Awaiting answer on why it was removed 5f81331 |
…/Unity-Technologies/com.unity.netcode.gameobjects into networkvar-unchanged-replication
com.unity.netcode.gameobjects/Runtime/NetworkVariable/NetworkVariable.cs
Outdated
Show resolved
Hide resolved
// Compares two values of the same unmanaged type bitwise | ||
// Ignoring any overriden value checks | ||
// Size is fixed | ||
private static unsafe bool ValueEquals(ref T a, ref T b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Compares two values of the same unmanaged type bitwise | |
// Ignoring any overriden value checks | |
// Size is fixed | |
private static unsafe bool ValueEquals(ref T a, ref T b) | |
[MethodImpl(MethodImplOptions.AggressiveInlining)] | |
private static unsafe bool ValueEquals(ref T a, ref T b) |
the comment block is out of date.
also what about hinting compiler to inline it too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is the comment out of date?
Could be inlined but I think it's premature optimization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean I think its fair that we should at least tell the compiler it could inline if possible. I mean inlining is a common practice where it makes sense would you not agree? I mean marking something as inline in say C++ is done with a purpose and I would expect no difference here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing. I'll add the flag as we are only using it in one place anyways.
@wackoisgod raised a fair point, would like to wait for conversation to resolve.
Setting the value of a NetworkVar to the same value it's currently set to no longer triggers replication.
MTT-2882
Changelog
com.unity.netcode.gameobjects
Testing and Documentation