Open hsandt opened 1 year ago
I reproduced part of the error with a Theme: I created a new theme and saved it, overwriting an existing theme.
This time, I didn't get the "possible cyclic resource inclusion" error. However, the reference failed to be updated in the inspector. From here, I can save and save again and it will keep prompting me for a path to save, until I actually save in a new file and not override an existing one.
So, the two errors (cyclic inclusion and reference not updating) may be unrelated.
Godot version
v4.0.stable.official [92bee43ad]
System information
Linux Ubuntu 22.04 with Unity desktop
Issue description
When saving an embedded resource in the node inspector as a resource file, and selecting an existing resource file that was previously set as target to overwrite it, the target file is overwritten, but you get an error:
and the reference will not be updated to the path to target file, so the node will still uses the embedded resource (so the target file is a mere unused copy of it).
Note that the error message is the same as in other issues like https://github.com/godotengine/godot/issues/70273 (but we trigger it in a different way).
This is also reproducible with the Animation Library manager.
Steps to reproduce
Reproducing the bug with AnimatedSprite2D and Sprite Frames
Reproducing the bug with CollisionShape2D and Collision Shape
Same as above, but select CollisionShape2D, Shape and collision_shape1/2.tres
Reproducing the bug with AnimationPlayer and AnimationLibrary
I think the Animation Library manager is interesting for resolution, because it has an extra Save As action that other resources don't have, and it works as expected. So looking at its implementation may be a hint to fix the issue.
In fact, we could even add a Save As action to the inspector embedded resource contextual menu, for a quick replacement of Make Unique + Save. But even then, we'd need to fix the issue when using Make Unique + Save separately.
Minimal reproduction project
Saving embedded resource overwriting existing one doesnt update resource reference.zip