Custom Assets wont create if not registered in the `AssemblyRegistry`
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: 4.2.0.2293
Platform(s): Windows
Describe the bug
When following the Custom Assets manual the Add asset option is there but upon clicking it the asset never gets created.
To Reproduce
Steps to reproduce the behavior:
- follow https://doc.stride3d.net/latest/en/manual/scripts/custom-assets.html
- put the templates and asset code in a separate external project
- see that the asset is shown in the
Add Assetwindow - Try adding the asset and see it does not get added
Expected behavior
The asset should be created.
Additional context
This is more for people to find a common issue if they are following a similar project structure of have multiple projects.
I will update the docs when I can and complete https://github.com/stride3d/stride-docs/issues/390 to show that its done.
Current Fix
Just create a class called Module.cs in the external project with the asset files and add the below code with your namespace:
using System.Reflection;
using Stride.Core;
using Stride.Core.Reflection;
YOUR_NAMESPACE;
internal class Module
{
[ModuleInitializer]
public static void Initialize()
{
// "AssemblyCommonCategories.Assets" gets registered on startup of the project in GameStudio and allows the template to be created from a separate project.
AssemblyRegistry.Register(typeof(Module).GetTypeInfo().Assembly, AssemblyCommonCategories.Assets);
}
}
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 issue by following the Custom Assets manual with templates and asset code in an external project. Start with the external project's Module.cs example and the AssemblyRegistry.Register entry point, then verify that the asset shown in the Add Asset window is created successfully; the related documentation update is tracked in stride-docs issue 390.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100