Skip to content
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

Duplicated files or resources retains the same UID #54774

Closed
Uxeron opened this issue Nov 8, 2021 · 18 comments · Fixed by #66706
Closed

Duplicated files or resources retains the same UID #54774

Uxeron opened this issue Nov 8, 2021 · 18 comments · Fixed by #66706

Comments

@Uxeron
Copy link
Contributor

Uxeron commented Nov 8, 2021

Godot version

4.0.dev (56cfebb)

System information

Windows 10

Issue description

When duplicating a file through the FileSystem dock, the duplicated file has the same UID as the original file. This leads to the wrong file being used later on, if something references the original and duplicated files.

Steps to reproduce

Duplicate a file through the FileSystem dock.
Open the original file in a text editor (or it's .import file if it has one)
Open the duplicated file the same way.
Notice that both file's UIDs are identical.

To see the issue with duplicated UIDs:
Duplicate a file through the FileSystem dock.
Add both the original and duplicated files to a scene.
Run the scene.
Notice that, instead of loading the original file, the duplicated file was loaded twice.

Minimal reproduction project

DuplicateTest.zip

Bugsquad edit (keywords for easier searching): ID

@Calinou Calinou added this to the 4.0 milestone Nov 8, 2021
@akien-mga akien-mga changed the title Duplicated file retains the same UID Duplicated files or resources retains the same UID Dec 3, 2021
@KoBeWi KoBeWi linked a pull request Dec 3, 2021 that will close this issue
@cammytown
Copy link

Until this is fixed, one can create a new scene (without using duplication) and copy paste the nodes, instead.

I think this is quite a high-priority bug in terms of how confusing it is for users. Thanks!

@lufog
Copy link
Contributor

lufog commented Mar 6, 2022

I think this is fixed, I can't reproduce it on v4.0.alpha.custom_build [272b355].

2022-03-06.17-03-38.mp4

@akien-mga
Copy link
Member

It was worked around in #55584, but we're not convinced that it's the proper fix for it.

@ywaby
Copy link

ywaby commented Apr 13, 2022

I can reproduce it with AtlasTexture.
Duplicate *.atlastex would gen a same uid and *.tres is work fine.

image

scene src

[gd_scene load_steps=3 format=3 uid="uid://o5k1cbo6e8vs"]

[ext_resource type="Texture2D" uid="uid://7mjm28afm5cy" path="res://new_atlas_texture.atlastex" id="1_l0am1"]
[ext_resource type="Texture2D" uid="uid://7mjm28afm5cy" path="res://2.atlastex" id="2_x7lof"]

project here uid same bug.zip
branch ver: v4.0.alpha.custom_build [895f2a2]

@floere
Copy link

floere commented Apr 24, 2022

I can still reproduce this for scene UIDs on 4.0 alpha 6 by duplicating a folder with a scene inside. The scene keeps the UID, even after changing the scene.

@KoBeWi KoBeWi moved this from To Assess to Todo in 4.x Priority Issues Jun 22, 2022
@ArseniyMirniy
Copy link

Will this be fixed before BETA? It looks like a very annoying bug that affects my workflow every single day.

@Calinou
Copy link
Member

Calinou commented Aug 8, 2022

Will this be fixed before BETA? It looks like a very annoying bug that affects my workflow every single day.

While this will be fixed before stable release, contributors work on a best-effort basis. Therefore, we can't make guarantees on whether this will be fixed before beta1 is released.

@YuriSizov
Copy link
Contributor

I'm lowering the priority of this issue and marking it to be fixed in beta rather than alpha. We've implemented a temporary fix before alpha 2 which covers all the text resources (#55584). Binary resources may not be handled well yet, but it should be okay for now.

@mickeyordog
Copy link
Contributor

I just ran into this bug again on v4.1.1.stable.mono.official [bd6af8e]. Duplicated a scene a couple times, but they each have the same UID
image

@Ratslayer
Copy link

Same thing here on 4.1.1.stable.mono and 4.1.2.stable.mono.
This is a major bug that makes duplicating scenes pretty worthless.

@debris
Copy link

debris commented Nov 11, 2023

I just ran into this bug again on v4.1.1.stable.mono.official [[bd6af8e]

just experienced it as well, same version :/

@ghost
Copy link

ghost commented Dec 14, 2023

my godot freezes when importing 5 image as atlas in 4.2.1

@ArdaE
Copy link
Contributor

ArdaE commented Jan 9, 2024

For those who are still experiencing this issue: Make sure that you duplicate resource/scene files using Godot's FileSystem dock and not your operating systems file manager (File Explorer, Finder, shell, etc.). The former will create new UIDs as needed, whereas the latter obviously will not.

It'd be nice if Godot displayed a warning when it detects multiple resource/scene files with the same UID, which can prevent a lot of headache*.

* I spent 15 minutes scratching my head why different fbx files that I configured to use different external material files all kept using the same material file (I kept reimporting them, thinking I must have misconfigured their import settings). While I did guess a UID issue in the end and checked, many junior developers may give up if they don't know about UIDs.

@ForkandBeard
Copy link

Just to add to @ArdaE's comment. Not a junior dev but new to Godot and lost a lot of time troubleshooting this issue with copied textures used in multiple materials. Didn't know about the UIDs until I did a diff against a working, simple project, vs my main project.

A warning for duplicate UIDs would be great.

@ArdaE
Copy link
Contributor

ArdaE commented Jan 23, 2024

I've added a discussion for a warning, godotengine/godot-proposals#8949, which someone may hopefully implement. It should be fairly easy to implement it.

@SweatyTryhardx10
Copy link

I am experiencing this as well in my first project. I just found the cause of the issue which is this: duplicate UIDs.

@AThousandShips
Copy link
Member

I am experiencing this as well in my first project. I just found the cause of the issue which is this: duplicate UIDs.

Specifically from duplicating a file inside the editor? Or from copying the file manually?

@SweatyTryhardx10
Copy link

SweatyTryhardx10 commented May 9, 2024

Specifically from duplicating a file inside the editor? Or from copying the file manually?

I can't comment on that since I'm not the individual that actually copied the file (it was a 2-man hobby project). I just noticed that the UID for the resources were identical which was causing materials to differ between editor and runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.