godotengine / godotengine/godot
No fix is offered for existing duplicate UIDs
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in: 4.4.beta [f0f5319b0b5b56db9f8023ac4132088df9e86b9e]
- Not reproducible in: 4.3.stable
### System information
Godot v4.4.beta (f0f5319b0) - Windows 11 (build 26100) - Multi-window, 3 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4070 Laptop GPU (NVIDIA; 32.0.15.6636) - AMD Ryzen 9 7940HS w/ Radeon 780M Graphics (16 threads)
### Issue description
(This might be better suited for a proposal perhaps, but strikes me as something we'd want to resolve in some way before 4.4-stable, so here we are.)
This issue is mostly to showcase a point of friction that's been introduced with the more stringent checks for duplicate UIDs in 4.4, which was in part introduced by #92972.
In short, projects that were seemingly functional in Godot 4.3 will, when upgraded to Godot 4.4, start emitting warnings about duplicate UIDs for any resources that happened to be copied/duplicated outside of Godot during development in Godot 4.3, without offering any sort of help or upgrade path, leaving the user to have to manually edit things like `.tres` files to resolve the duplicates in some way themselves.
To expand on the "seemingly functional" part: While duplicate UIDs will cause issues even in Godot 4.3, one of the use-cases where you wouldn't really run into any of them is if you were dynamically loading custom resources by path at runtime, in which case (I believe) the UIDs never really came into play. It's possible that there are simpler examples that are more widely applicable as well.
To be clear, the fact that files were copied outside of Godot is of course the root problem here and ideally shouldn't have happened, but given that Godot 4.3 had no real checks for this the problem can be pervasive across the project and difficult to resolve. I feel like Godot should try to make some kind of effort towards helping the user in some way.
I'm not sure what the fix should be, especially considering that you don't really have a reliable notion of a newer versus older file in these kinds of cases, like you do when new files are added (#100927) while the editor is running. Perhaps it's as simple as offering a sweeping replace of UIDs found to have a duplicate, and just accepting that there may be broken references, since that's likely what the user would end up doing anyway.
### Steps to reproduce
- Open the MRP in 4.3-stable.
- Note how the project runs fine without warnings and prints the two different greetings.
- Upgrade the MRP to 4.4-beta.
- Note how the project still runs fine.
- Note warning shown about `UID duplicate detected between res://greeting2.tres and res://greeting1.tres`.
- Realize you're forced to resolve this manually.
- Dread doing this.
### Minimal reproduction project (MRP)
[existing-duplicate-uids.zip](https://github.com/user-attachments/files/18693205/existing-duplicate-uids.zip)
Contributor guide
Assessment
This issue has not been assessed yet.