Skip to content

fix: do not override GlobalObjectIdHash in Editor#744

Merged
0xFA11 merged 3 commits intodevelopfrom
fix/gobjid-editor
Apr 16, 2021
Merged

fix: do not override GlobalObjectIdHash in Editor#744
0xFA11 merged 3 commits intodevelopfrom
fix/gobjid-editor

Conversation

@0xFA11
Copy link
Copy Markdown
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
Copy Markdown
Member

@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!

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
Copy Markdown
Member

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