Skip to content

GlobalObjectIdHash collisions occur when a prefab has instances in multiple scenes before adding NetworkObject #2644

@zachstronaut

Description

@zachstronaut

Description

When a prefab exists in multiple scenes, and then later you add a NetworkObject that that prefab, the instances will have GlobalObjectIdHash collisions in any unopened scenes when you make this edit.

Reproduce Steps

  1. Open Bossroom sample
  2. Open DungeonEntrance scene
  3. Create a new prefab and add two instances to scene and save
  4. Open DungeonBossRoom scene
  5. Add two instances of the new prefab to scene and save
  6. Edit the prefab and add a NetworkObject
  7. Open Startup scene
  8. Run game and ready-up into gameplay
  9. Error will occur

Actual Outcome

"Exception: TestPrefab (1) tried to registered with ScenePlacedObjects which already contains the same GlobalObjectIdHash value 3700887716 for TestPrefab!"

Expected Outcome

Every instance of the prefab would have a unique id.

Netcode needs a way to handle NetworkObject GUIDs (GlobalObjectId) outside of OnValidate() because of issues like this. Netcode also doesn't provide any menu option to re-issue ids to every NetworkObject in a scene and we've had to build that ourselves.

Environment

  • OS: Windows 11
  • Unity Version: 2022.3.0, 2021.3.11
  • Netcode Version: 1.4.0, 1.5.1

Metadata

Metadata

Labels

priority:highThis issue has high priority and we are focusing to resolve itstat:importedStatus - Issue is tracked internally at Unitytype:bugBug Report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions