Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

AssetCompiler is unable to resolve material references from layers of materials #1477

Open
laske185 opened this issue Jul 25, 2022 · 2 comments · May be fixed by #1478
Open

AssetCompiler is unable to resolve material references from layers of materials #1477

laske185 opened this issue Jul 25, 2022 · 2 comments · May be fixed by #1478
Labels
bug Something isn't working

Comments

@laske185
Copy link

Release Type: Official Release

Version: 4.1.0.1734

Platform(s): Windows

Describe the bug
The asset compiler throws an exception when a material uses in a layer another material that is already used f.e. by a model.
The issue is non-deterministic an depends on the order the references are handled in one run.

To Reproduce
Steps to reproduce the behavior:

  1. Create a scene with the following setup:
flowchart TD
  subgraph Entity
    ModelComponent
    SomeComponent[Some component with a reference to a material]
  end
  subgraph MaterialB[Material B]
    Layer[Layer 1]
  end
  ModelComponent --> Model  --> MaterialA[Material A]
  SomeComponent--> MaterialB --> Layer --> MaterialA
Loading
  1. The asset compiler compiles successfully when material A is visited via the model first, but failes when it is visited through material B the first time.

Expected behavior
The asset compiler always handles the referenced materials in layers of materials correctly.

Log and callstacks

1>info 7,732s: [AssetCompiler] Build finished in 2368 steps. Command results: 4 succeeded, 2364 up-to-date, 0 failed, 0 not triggered due to previous failure.
1>info 7,732s: [AssetCompiler] Build is successful.
1>info 7,766s: [AssetCompiler] Generate bundles: Scan assets and their dependencies...
1>info 7,767s: [AssetCompiler] Generate bundles: Assign assets to bundles...
1>EXEC : error 7,830s: [AssetCompiler] Unhandled exception. Exception: InvalidOperationException: Could not find asset Materials/Buildings/Storage house/roof_01 for bundle default
1>   at Stride.Core.Assets.CompilerApp.BundlePacker.CollectBundle(DatabaseFileProvider databaseFileProvider, ResolvedBundle resolvedBundle, String assetUrl) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\assets\Stride.Core.Assets.CompilerApp\BundlePacker.cs:line 358
1>   at Stride.Core.Assets.CompilerApp.BundlePacker.CollectBundle(DatabaseFileProvider databaseFileProvider, ResolvedBundle resolvedBundle, String assetUrl) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\assets\Stride.Core.Assets.CompilerApp\BundlePacker.cs:line 370
1>   at Stride.Core.Assets.CompilerApp.BundlePacker.CollectBundle(DatabaseFileProvider databaseFileProvider, ResolvedBundle resolvedBundle, String assetUrl) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\assets\Stride.Core.Assets.CompilerApp\BundlePacker.cs:line 370
1>   at Stride.Core.Assets.CompilerApp.BundlePacker.Build(Logger logger, PackageSession packageSession, Package rootPackage, String indexName, String outputDirectory, ISet`1 disableCompressionIds, Boolean useIncrementalBundles, List`1 bundleFiles) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\assets\Stride.Core.Assets.CompilerApp\BundlePacker.cs:line 152
1>   at Stride.Core.Assets.CompilerApp.PackageBuilder.BuildMaster() in C:\BuildAgent\work\b5f46e3c4829a09e\sources\assets\Stride.Core.Assets.CompilerApp\PackageBuilder.cs:line 168
1>   at Stride.Core.Assets.CompilerApp.PackageBuilder.Build() in C:\BuildAgent\work\b5f46e3c4829a09e\sources\assets\Stride.Core.Assets.CompilerApp\PackageBuilder.cs:line 57
1>   at Stride.Core.Assets.CompilerApp.PackageBuilderApp.Run(String[] args) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\assets\Stride.Core.Assets.CompilerApp\PackageBuilderApp.cs:line 302
1>System.InvalidOperationException: Could not find asset Materials/Buildings/Storage house/roof_01 for bundle default
1>   at Stride.Core.Assets.CompilerApp.BundlePacker.CollectBundle(DatabaseFileProvider databaseFileProvider, ResolvedBundle resolvedBundle, String assetUrl) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\assets\Stride.Core.Assets.CompilerApp\BundlePacker.cs:line 358
1>   at Stride.Core.Assets.CompilerApp.BundlePacker.CollectBundle(DatabaseFileProvider databaseFileProvider, ResolvedBundle resolvedBundle, String assetUrl) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\assets\Stride.Core.Assets.CompilerApp\BundlePacker.cs:line 370
1>   at Stride.Core.Assets.CompilerApp.BundlePacker.CollectBundle(DatabaseFileProvider databaseFileProvider, ResolvedBundle resolvedBundle, String assetUrl) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\assets\Stride.Core.Assets.CompilerApp\BundlePacker.cs:line 370
1>   at Stride.Core.Assets.CompilerApp.BundlePacker.Build(Logger logger, PackageSession packageSession, Package rootPackage, String indexName, String outputDirectory, ISet`1 disableCompressionIds, Boolean useIncrementalBundles, List`1 bundleFiles) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\assets\Stride.Core.Assets.CompilerApp\BundlePacker.cs:line 152
1>   at Stride.Core.Assets.CompilerApp.PackageBuilder.BuildMaster() in C:\BuildAgent\work\b5f46e3c4829a09e\sources\assets\Stride.Core.Assets.CompilerApp\PackageBuilder.cs:line 168
1>   at Stride.Core.Assets.CompilerApp.PackageBuilder.Build() in C:\BuildAgent\work\b5f46e3c4829a09e\sources\assets\Stride.Core.Assets.CompilerApp\PackageBuilder.cs:line 57
1>   at Stride.Core.Assets.CompilerApp.PackageBuilderApp.Run(String[] args) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\assets\Stride.Core.Assets.CompilerApp\PackageBuilderApp.cs:line 302
@laske185 laske185 added the bug Something isn't working label Jul 25, 2022
laske185 added a commit to laske185/stride that referenced this issue Jul 25, 2022
@dawnmichal
Copy link

dDrive.zip

This is simple project using material archetypes. It cause same error as above, but only at specific HDD location. When it is coppied to another location it builds fine. Is it possible that this can affect the order of the asset compilation? For example, in what order are the files returned from disk and in what order does compilation occur? So it's very likely that you won't get the error... But this simple project cause problem at least in my case...

@laske185
Copy link
Author

laske185 commented Dec 1, 2023

The behavior always occurs. But it can succeed when the previous build already compiled the assets. It can always be reproduced when the data folder in the bin folder is removed. F.e. .\Bin\Windows\Debug\win-x64\data.

I created a sample project to reproduce the error: https://github.com/laske185/stride3d-sample-MaterialAssetCompilersBuildDependency

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants