.uid
files are not recreated if deleted by the user #99779
Description
Tested versions
- Reproducible in: v4.4.dev5.official.9e6098432
- Not reproducible in: 4.4.dev4 and earlier (not applicable)
System information
Godot v4.4.dev5 - Ubuntu 24.04.1 LTS 24.04 on X11 - X11 display driver, Multi-window, 2 monitors - OpenGL 3 (Compatibility) - NVIDIA GeForce GTX 1060 6GB (nvidia; 535.183.01) - Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz (4 threads)
Issue description
If you delete the new .uid
file for a resource (such as a .gd script), it will not be recreated and there's no way to force recreation other than deleting the .godot directory.
Bit of a weird bug because it's in part due to user error. But it's a simple mistake that gets your project into a broken state. I hit this by upgrading one of my old projects (from 4.4.dev3), a whole bunch of UID files were created and I thought "that's weird" and git clean'd them. Then I read about the design of it and realized they needed to be committed to revision control, so I tried everything I could to get them recreated, but nothing worked, other than deleting the entire .godot directory.
I gather from the design of the .uid files that this means the project is now in a broken state, as every file is expected to have a UID. I can't find any way to force the regeneration of the UID other than to delete the .godot
directory, after which time it will create new UID files.
Steps to reproduce
- Create a new project.
- Create a new scene (just based on Node, or whatever). Save as
scene.tscn
. - Attach a script to that scene. Save as
scene.gd
and re-savescene.tscn
. Verify thatscene.gd.uid
has automatically been created with contents:uid://pug2wk8lb40l
. I will also note thatscene.tscn
will not reference the UID - it just referencesscene.gd
by filename:[ext_resource type="Script" path="res://scene.gd" id="1_ulcgi"]
.) - In Godot, Reload Current Project. Re-save
scene.tscn
. Verify that inscene.tscn
it will refer toscene.gd
using its UID:[ext_resource type="Script" uid="uid://pug2wk8lb40l" path="res://scene.gd" id="1_ulcgi"]
. - In an external program, delete
scene.gd.uid
. - In Godot, Reload Current Project. Bug:
scene.gd.uid
will not be recreated.
So there are two seemingly related issues here: firstly, on Step 3, it's weird that the scene does not reference the UID of the script it just created. Note that I needed to add Step 4 because if you delete scene.gd.uid
while in this state, it will actually get recreated. The .uid only doesn't get recreated after a project reload, which makes the UID show up in the .tscn file.
Minimal reproduction project (MRP)
Project state after following the steps to reproduce above. However note that if you open this, it will recreate the .uid file because the .godot directory has been removed. Try deleting the file again and note that it won't be recreated.
Metadata
Assignees
Type
Projects
Status
Bad
Activity