Fixed Hundreds of errors when starting the editor

Godot Version

4.3

Question

I transferred the project to another laptop, moved the .godot folder, problems began - hundreds of errors fileled loading, unable open, script compilation…
Bugs that also constantly interfere with life when manually changing paths, especially when cleaning up the project after installing addons.

Solved the problem by deleting all *.import files and full-text replacement in all *.tscn files - removed all links to the cache (replacement with an empty line)
Here is a regular for replacement:

uid=\"[^\"]+\"

Alternatively you can try resaving every file.

I got this script from a github issue, as this issue has plagued version control systems for a long time now. if you didn’t transfer the .godot folder it will have this issue. and *.import files are important as these contain import settings for assets.

# script goes through project resaving files in editor resolving invalid UID issues
# open script in editor and run with right-click 
@tool
extends EditorScript

var files: Array[String]

func _run() -> void:
	files = []

	add_files("res://")

	for file in files:
		print("fix_uid: ",file)
		var res = load(file)
		ResourceSaver.save(res)

func add_files(dir: String):
	for file in DirAccess.get_files_at(dir):
		if file.get_extension() == "tscn" or file.get_extension() == "tres" or file.get_extension() == "material":
			files.append(dir.path_join(file))

	for dr in DirAccess.get_directories_at(dir):
		add_files(dir.path_join(dr))

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.