Error when assets in different projects with the same relative path
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 7.8k
- Forks
- 1.2k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 49
Description
Release Type: Official Release
Version: All
Platform(s): Editor/Asset compiler
Describe the bug
Not sure to classify this fully as a bug or an engine quirk.
If you have the two assets with the same name + relative path in different projects, the editor will not compile the asset, and will give the error:
Error: Assets [C:/MyGame_4_2_0_2188/MyGame_4_2_0_2188/Assets/Capsule.sdpromodel] with location [Capsule] from Package [C:/MyGame_4_2_0_2188/MyGame_4_2_0_2188.Windows/MyGame_4_2_0_2188.Windows.sdpkg] is already loaded from package [C:/MyGame_4_2_0_2188/MyGame_4_2_0_2188/MyGame_4_2_0_2188.sdpkg]
The cause of this is:
https://github.com/stride3d/stride/blob/dbb125e19a48715dd9fa7cf200a7d3f75f2fbb78/sources/assets/Stride.Core.Assets/Analysis/AssetAnalysis.cs#L79-L83
I believe the rationale for this is because in a game, all assets in multiple referenced projects are flattened to a single 'database'.
You load the asset via ContentManager.Load(path) where path is the asset relative path, therefore the path must be effectively considered an ID.
To Reproduce
Steps to reproduce the behavior:
- Create new My game template and open in Stride Editor
- Go to Windows project and add new asset, eg. Add asset -> Model -> Capsule
- Go to Game project and add new asset, eg. Add asset -> Model -> Capsule
- Try save project/session.
Expected behavior
Not sure, explain the error message better?
Allowing it to have the same relative path sounds nice, but may break ContentManager.Load, unless you can specify something like a package id to tie break dupe paths.
This will have future problems when if user distributed plugins/assets come around.
Additional context
Somewhat related to the effect compiler issue in #301 & #446 (where it's generating a dupe effect log), but this affects more than just that.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure by creating identical Capsule assets in the Windows and Game projects, then inspect sources/assets/Stride.Core.Assets/Analysis/AssetAnalysis.cs at the referenced lines. Trace how ContentManager.Load uses relative paths and how referenced packages are flattened. Done requires an agreed behavior for duplicate paths, including whether the error should be clarified or package identity should disambiguate loading.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- game-dev, tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100