-
Notifications
You must be signed in to change notification settings - Fork 463
chore: simplify accessors network object #3831
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
base: develop-2.0.0
Are you sure you want to change the base?
chore: simplify accessors network object #3831
Conversation
|
|
||
| // Standard non-authority synchronization is handled here | ||
| if (!CanCommitToTransform && NetworkManager.IsConnectedClient && SynchronizeState.IsSynchronizing) | ||
| if (!CanCommitToTransform && m_CachedNetworkManager.IsConnectedClient && SynchronizeState.IsSynchronizing) |
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.
Is this change useful on an optimization point of view?
| var forUpdate = true; | ||
| #endif | ||
| if (m_CachedNetworkObject != null) | ||
| if (m_CachedNetworkObject) |
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.
Rider suggested converting "==" to explicit Unity engine object lifetime check. Should we keep or revert those changes?
| return GlobalObjectIdHash; | ||
| } | ||
| } | ||
| public uint PrefabIdHash => GlobalObjectIdHash; |
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.
Should we keep this in multiple lines instead of my change?
| // the NetworkManager is shutting down, the NetworkObject is not spawned, it is an in-scene placed | ||
| // NetworkObject, or the GameObject's current scene handle is the same as the SceneOriginHandle | ||
| if (!SceneMigrationSynchronization || !IsSpawned || NetworkManager == null || NetworkManager.ShutdownInProgress || | ||
| if (!SceneMigrationSynchronization || !IsSpawned || NetworkManager.ShutdownInProgress || |
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.
Should we keep NetworkManager null checks here?
| // Early exit if there is no NetworkManager assigned, the NetworkManager is shutting down, the NetworkObject | ||
| // is not spawned, or an in-scene placed NetworkObject | ||
| if (NetworkManager == null || NetworkManager.ShutdownInProgress || !IsSpawned || IsSceneObject != false) | ||
| if (NetworkManager.ShutdownInProgress || !IsSpawned || IsSceneObject != false) |
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.
Should we keep the NetworkManager null checks here?
| /// Gets if the object is the personal clients player object | ||
| /// </summary> | ||
| public bool IsLocalPlayer => NetworkManager != null && IsPlayerObject && OwnerClientId == NetworkManager.LocalClientId; | ||
| public bool IsLocalPlayer => IsPlayerObject && OwnerClientId == NetworkManager.LocalClientId; |
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.
If I understand correctly, NetworkManager cannot be null as we are using the Singleton so I removed some NetworkManager null checks. Should those checks be kept anyways?
Purpose of this PR
Jira ticket
MTT-13657
Changelog
Documentation
Testing & QA (How your changes can be verified during release Playtest)
Functional Testing
Manual testing :
Manual testing doneAutomated tests:
Covered by existing automated testsCovered by new automated testsDoes 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