You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Purpose of this PR
Optimize property accessors around `NetworkVariable`
1. Keep a self reference to `m_NetworkBehaviour`, `m_NetworkObject` and
`m_NetworkManager`
2. Swap `CanWrite` and `CannotWrite` to aggressively inlined functions
3. Store a `m_UseServerTime` boolean that can be calculated once rather
than on every check on the NetworkVar
4. Add early returns in the `NetowrkVariableDeltaMessage` to reduce
indentation and increase readability.
### Jira ticket
Needs a JIRA ticket
### Changelog
- Changed: Improved performance of NetworkVariable property accessors.
## Documentation
- No documentation changes or additions were necessary.
## Testing & QA (How your changes can be verified during release
Playtest)
These changes are less risky and should be covered by the automated
testing.
### Functional Testing
[//]: # (If checked, List manual tests that have been performed.)
_Manual testing :_
- [ ] `Manual testing done`
_Automated tests:_
- [x] `Covered by existing automated tests`
- [ ] `Covered by new automated tests`
_Does the change require QA team to:_
- [ ] `Review automated tests`?
- [ ] `Execute manual tests`?
- [ ] `Provide feedback about the PR`?
If any boxes above are checked the QA team will be automatically added
as a PR reviewer.
## Backports
This is a performance improvement so backporting this fix isn't
necessary.
@@ -266,7 +266,7 @@ public override bool IsDirty()
266
266
{
267
267
// If the client does not have write permissions but the internal value is determined to be locally modified and we are applying updates, then we should revert
268
268
// to the original collection value prior to applying updates (primarily for collections).
// If the client does not have write permissions but the internal value is determined to be locally modified and we are applying updates, then we should revert
330
330
// to the original collection value prior to applying updates (primarily for collections).
@@ -370,7 +370,7 @@ public override void ReadField(FastBufferReader reader)
370
370
{
371
371
// If the client does not have write permissions but the internal value is determined to be locally modified and we are applying updates, then we should revert
372
372
// to the original collection value prior to applying updates (primarily for collections).
Debug.LogWarning($"[{m_NetworkBehaviour.name}][{m_NetworkBehaviour.GetType().Name}][{GetType().Name}][Initialize] {nameof(NetworkManager)} has no {nameof(NetworkTimeSystem)} assigned!");
138
145
}
@@ -251,7 +258,7 @@ public virtual void SetDirty(bool isDirty)
251
258
internalboolCanSend()
252
259
{
253
260
// When connected to a service or not the server, always use the synchronized server time as opposed to the local time
0 commit comments