stride
stride copied to clipboard
AssetCompiler is unable to resolve material references from layers of materials
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:
- 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
- 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
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...
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