stride icon indicating copy to clipboard operation
stride copied to clipboard

Moved/renamed Assets dont update UrlReference references

Open Doprez opened this issue 8 months ago • 2 comments

Release Type: Official Release

Version: 4.2.2381

Platform(s): Windows

Describe the bug When you have an asset in the asset explorer that is referenced in a scene. Moving or renaming that asset will not update those references in the build.

To Reproduce Steps to reproduce the behavior:

  1. Create a basic project
  2. reference the GameSettings Asset in a component using a UrlReference
  3. use Content.Load in that component script(just for seeing the error)
  4. when the asset is moved and the projects is rebuilt and run see the asset at the previous location

Expected behavior references should be updated automatically.

Additional context In the editor the reference Url does get updated but it just doesnt show in the actual build causing it to not be noticeable until you run the game.

public class TestComponent : StartupScript
{
    public UrlReference<GameSettings> Item { get; set; }

    public override void Start()
    {
        var item = Content.Load(Item);
    }
}

Doprez avatar Apr 08 '25 17:04 Doprez

The issue seems to be coming from AssetDependancyManager just missing the feature to update Assets that also reference a changed asset in Session_AssetDirtyChanged line 516

Although I dont understand why the Game Studio doesnt show that the asset hasnt moved? If the field in Game Studio shows the change shouldnt that update on save as well?

Doprez avatar Apr 08 '25 17:04 Doprez

It seems like this error is new to the most recent release due to https://github.com/stride3d/stride/pull/2528. I think I understand the error that was fixed and I dont think we need to revert it but maybe we can get a list of assets to update based on the LinksOut of an Asset being tracked? I think doing that in the referenced method above could be a solution?

Doprez avatar Apr 08 '25 17:04 Doprez