-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add documentation on how to fix corrupt UIDs in a project (workaround inside) #68661
Comments
Hello, I now have the same problem with my update process. For my use case I have an integrated plugin upgrade tool where a new version is installed when it is available. For more background, the uid's are a kind of cache to reference resources. And important when you deliver a plugin the cached resources are never be part of the plugin and you will run always into this issue. As example i have a animated texture resource
Each included texture (Progress*.svg) has a uid but the uid will never match when you install the plugin at first time. Please fix this bug as soon as possible, this kind of error is confusing the user. |
Deleting an .import file (the editor re-imports it) will produce this warning ("invalid UUID - using text path instead") for every scene that uses that file, clogging the output. |
Thanks for the workaround. Here is an improved method that works on git bash or any unix shell in windows or linux. This will find all tscn files, run perl to search and replace on the file to strip out UIDs.
You can change @Lippanon manually save your scenes as tscn, then revert. Or leave them as tscn. You should be using git, even as a solo dev, and things that change all the time like scenes will both fill up your git server, and not allow you to review your changes before committing. I recommend using git and tscn, tres, no .material, .scn. Only use binary files for things that will not change, such as glb and texture files. |
Right clicking a file in the editor gives an option to copy the UID of that file. This can be used to manually edit the invalid/corrupt UID in scenes that use that file. |
I don't know if this changed since then or was always like that, but when you re-save the scene/resource, all stored UIDs will get updated. |
Can confirm. I think it changed at some point. Re-saving the scene/resource fixes the invalid UIDs. |
This is still a problem, even in 4.0-stable with entirely new UIDs, new cache directories and a new UID database. I used my command to strip out UIDs: Then I used the script below to have Godot automatically load and resave all .tres/res files in the project. It can also work on other file types or specific directories by changing the parameters. It upgrades the format types for .tres/.res files without having to manually open them and click the save icon one by one.
You could add .tscn to the extensions and see if it will work with that, however in my testing it appears insufficient compared to opening all scenes and saving them. Create a test scene, attach this script, save, close, and reopen the scene. It will process everything upon reopening, since it's a tool.
|
I've been having non-stop problems with UIDs since upgrading from v3 to v4. I had to not only copy all .import files from one machine to another, but also the entire .godot folder, or the project could not re-generate from a clean slate (editor crashes). Which is really disturbing... because I thought those files were unnecessary to track... but copying .godot folder and .imports from one machine to another fixed the issue, so I moved on, not wanting to deal with it Anyhow as time went on I began to create more assets like .PNG files and commit them, along with their .import files and now on different machines the UIDs are conflicting because Godot generates different UIDs in the .tscn files on different machines, and slowly my project is filling up with yellow resource warnings in the console, and I have to comb through diffs to see if files really changed or is it just the UIDs changing again.... @TokisanGames is this the same issue you are solving with your script above? |
What is the standard practice with .import and .godot folder? Do we commit them or not? Seems like either choice causes headaches |
Commit
However there is a bug #75388 that basically means |
You should commit
I followed this workflow and don't have any UID problems in my project. If you experience some UID-related bugs, try making a minimal project that reproduces it. |
Do you have any Image subresources? Do you have a custom theme? The UID bug described in this issue is still undoubtedly present. My theme and subresources are still changing every day even after wiping all UIDs from every scene and resource file and the cache. The workaround in this ticket does remove UIDs. It does not workaround the bug at all as UIDs still keep changing. Original issue #62258, which was closed but not fixed by #72257 Make a new theme, attach it to a scene, and save it. Restart, save the scene again, UIDs changed. MRP 4.0.1. Backup new_theme.tres. Open the project and control.tscn. Save it. Diff
|
@KoBeWi Have you tried adding new resources to your project from different machines? I believe that's where most of my UID issues come from. I also get UIDs in .tres tileset resources changing from machine to machine, but it seems like a separate issue. |
@TokisanGames Why does your theme have binary Image data saved as text? Also this is unrelated to UIDs. UIDs identify resource files, sub-resource ids are a different thing. |
This isn't my game's theme. It's the default theme saved to a file. You asked for an MRP to highlight the problem. Whether there is binary data converted to text in the file (which is fully supported by Godot) is irrelevant. The problem is Godot changes the IDs on every save. The problem is not limited to themes, I experience it in countless files. Making a theme off of the default is just the fastest way to consistently show the issue.
This is the first time you've mentioned this though we've been talking about it since October as noted on the other ticket. I didn't know UIDs and sub resource IDs are different. Nevertheless, the sub resource IDs change every day and it's a problem for Git and all of us developers. So what do you want to do? There are many developers with this problem. If you've fixed all of the UID problems, then all of us experiencing problems have subresource ID problems. There are already several tickets related but closed, a few that are open. Do you want to start another brand new ticket with the subresource ID issue or continue talking about it in the ongoing discussions? |
The Image does not change its id. The problem in the MRP you attached is that the font generates new image every time. It's a different image, hence it has different id. The comment I linked explains it.
Then it's a problem with the default theme. It should not be embedding Fonts, because it leads to the aforementioned issue. Do you know any bug with sub-resource ids that doesn't involve fonts?
Sub-resource ids don't just change randomly. If it happens, it's either caused by some buggy logic involving a specific resource or some wrong usage of resources. I think every such case should be reported as a separate issue. |
I see. I experience it on a resource that my enemies use for their stats. Stats is a resource table marked eg.
Edit: My theme and these Stats are probably 95-100% of my subresource id issues. Now that I know the cause, I can probably eliminate all of my subresource id issues on my own. |
AFAIK |
I was able to workaround the issues with my subresource IDs. We learned today that UIDs are for external files, and have likely been fixed. However you may need to strip out all UIDs in all scenes and resources and let Godot generate new ones using the workarounds in this ticket. Subresource IDs are for resources saved in the scene file. Godot regenerates new IDs for them on every save. This problem should be fixed in the engine by reusing the same ID on resources that haven't changed. However, I was able to work around them on my project with the following. External resources marked "resource_local_to_scene" Themes So far this seems to have addressed everything. Git still reports that Godot has changed line endings on many resources and scenes, so the files show as changed. Though they disappear when staged. Cc @lesleyrs |
This is mainly because the copy of the resource is not associated with the information of the original resource ( |
This PR exposes the
Renaming the UID path to an empty string seems to cause the UID reference to be completely removed from the external reference, replacing it with the path instead. You can preferably pass the This gives a clue as to what's happening to cause the invalid UID errors: the I wonder why |
What should be implemented is at the location where the error is thrown regarding the missing UID, |
Just wanted to note that this is also happening with assets from the AssetLib. I tried Ridiculous Coding on the 4.1 RC3 and got a bunch of spam about UID's. I tried opening the tscn files to rename them, but Godot said the files were corrupt. Interestingly, the addon still works aside from all the UID spam. https://github.com/jotson/ridiculous_coding/tree/godot4 Edit: Might be a problem with that specific asset because it doesn't have the .import files checked in. |
Hello, I do not really understand what is behind this bug reproduction, but I share this as there are actually no minimal reproduction example for the moment. When scene_c are loaded from scene_b, so scene_c seems to not load the link back to scene_b Important note : To see the error, running the project is enough. Here is the project : issues68661.zip (PS : I tried the "workarround" proposed in the previous comment, but, my project seems to "re-generate" the bugs. So it doesn't work here) |
@dtesniere Scene B depends on Scene C and vice-versa. You created a cyclic dependency, which is not supported. |
from godotengine/godot#68661 right clicking a file in godot can get the UID. opening the scene in a text editor lets you change out the broken uid.
Following godotengine/godot#68661 The warnings at startup are gone, at least
This still happens and leads to headaches when multiple people work on the project and use Git. |
Merge conflicts are inevitable, but they are easy to resolve now, because every sub-resource in scene has unique ID instead of sequential number. |
I figured the culprit why we had this issue in the first place. I don't know whether it was our mistake to exclude import files or whether Godot generated the .gitignore file that way. |
The only way I can keep sanity is to have ONLY ONE machine generating and adding new .import files. The other machines get spammed with yellow warnings but at least the repo stays clean. There must be something that is causing same-project UIDs to be generated differently on different machines, maybe Godot is using home/absolute directory or something machine-dependent as the seed? |
Going from 4.2.2 to 4.3RC3 is causing this error on a few of my scenes. |
Godot version
4.0 dev
System information
all
Issue description
In some projects and others people are reporting this issue:
I believe it's a bug between our alpha and beta godot version, we should fix it, as it appears to not just be The Mirror that has the bug.
A workaround I found I would like to share
I found a working fix for this which can resolve the problem for an entire project, its quite slow to do, but it has worked in our case to clear up all our UID issues. (this goes without saying but I'll say it: MAKE BACKUPS before you do this)
Steps to reproduce
Unsure how the bad UIDs were introduced but they seem to disappear by doing my workaround.
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: