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
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
Open Bossroom sample
Open DungeonEntrance scene
Create a new prefab and add two instances to scene and save
Open DungeonBossRoom scene
Add two instances of the new prefab to scene and save
Edit the prefab and add a NetworkObject
Open Startup scene
Run game and ready-up into gameplay
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
The text was updated successfully, but these errors were encountered:
zachstronaut
changed the title
Globalo
GlobalObjectIdHash collisions occur when a prefab has instances in multiple scenes before adding NetworkObject
Jul 26, 2023
Additionally, if you open the scenes after the fact and look at these new NetworkObjects in the Inspector they will visually show unique ids but the scene will not be dirty so it will not be save-able.
@zachstronaut
I believe #2662 resolves this issue.
Did a quick test using some of the test project scenes and it seemed to work fine. (will run the exact same steps you outlined above using Boss Room in the morning to double check)
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
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
The text was updated successfully, but these errors were encountered: