Skip to content

fix: do not override GlobalObjectIdHash in Editor #744

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
merged 3 commits into from
Apr 16, 2021
Merged

Conversation

0xFA11
Copy link
Contributor

@0xFA11 0xFA11 commented Apr 15, 2021

as the comment says:

// do NOT override GlobalObjectIdHash while getting into PlayMode in the Editor

this was causing a soft-sync issue where a prefab with NetworkObject component attached that wasn't registered with NetworkManager would regenerate (recompute) GlobalObjectIdHash again and override NetworkObject's serialized GlobalObjectIdHash field while getting into PlayMode in the Editor.

Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity left a comment

Choose a reason for hiding this comment

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

awesome!
Smallest PR EVARRR!

@@ -333,7 +339,7 @@ public static void NetworkHide(List<NetworkObject> networkObjects, ulong clientI

private void OnDestroy()
{
if (NetworkManager.Singleton != null && NetworkManager.Singleton.SpawnManager.SpawnedObjects.ContainsKey(NetworkObjectId))
if (NetworkManager.Singleton != null && NetworkManager.Singleton.SpawnManager != null && NetworkManager.Singleton.SpawnManager.SpawnedObjects.ContainsKey(NetworkObjectId))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see you found the same bug I found earlier where the SpawnManager no longer exists but objects are still being destroyed.

@0xFA11 0xFA11 force-pushed the fix/gobjid-editor branch from 0329ab9 to af99950 Compare April 15, 2021 23:52
@0xFA11 0xFA11 merged commit a9a6ec2 into develop Apr 16, 2021
@0xFA11 0xFA11 deleted the fix/gobjid-editor branch April 16, 2021 00:07
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.

2 participants