stride3d / stride3d/stride

Error when assets in different projects with the same relative path

Open
#2,361 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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:

  1. Create new My game template and open in Stride Editor
  2. Go to Windows project and add new asset, eg. Add asset -> Model -> Capsule
  3. Go to Game project and add new asset, eg. Add asset -> Model -> Capsule
  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.