Quick answer: Open the duplicate’s .import file in a text editor, replace the uid= line with a fresh string (or delete it and let Godot regenerate on reimport), save, and reimport. Don’t commit the .godot/ cache directory.
You copied a folder from another Godot project. Editor warns “UID collision” for every asset. Godot picks the wrong one for some load("uid://...") calls.
The Symptom
Editor console shows “UID collision: ResourceA / ResourceB share uid://...”. Loads occasionally return the wrong asset. Renames in FileSystem propagate but UIDs stay duplicated.
The Fix
Single asset. Open the .import file (e.g. art/icon.png.import) in any text editor:
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b73h9wkdex2c" # DELETE this line
Save. In Godot, right-click the asset → Reimport. A new UID is generated.
Many assets. An editor script:
@tool
extends EditorScript
func _run() -> void:
var dir := "res://duplicated_folder"
for f in ResourceLoader.get_recognized_extensions_for_type(""):
_walk(dir)
func _walk(path: String) -> void:
var da := DirAccess.open(path)
if da == null: return
for name in da.get_files():
if name.ends_with(".import"):
var p := path.path_join(name)
var txt := FileAccess.open(p, FileAccess.READ).get_as_text()
txt = txt.replacen(RegEx.create_from_string("uid=\"[^\"]+\""), "")
FileAccess.open(p, FileAccess.WRITE).store_string(txt)
for sub in da.get_directories():
_walk(path.path_join(sub))
Then reimport the folder. New UIDs everywhere.
Don’t Commit .godot/
The .godot folder holds derived caches. Add to .gitignore:
# .gitignore
.godot/
.import/
Verifying
Reload the project. Console should be free of collision warnings. load("uid://...") calls return the right asset.
“Strip the uid line. Reimport. UIDs regenerate.”
Related Issues
For Godot resource not found, see resource load. For texture import slow, see large textures.
Strip and reimport. Collisions clear.