Skip to content

Commit

Permalink
Merge pull request #386 from stride3d/master
Browse files Browse the repository at this point in the history
Deploy latest documentation updates to staging
  • Loading branch information
VaclavElias authored Feb 1, 2025
2 parents e1b278e + 2948245 commit 30e4948
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions en/manual/scripts/best-practice.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This will set some expectation as to where the system you're building should res

Some entry and exit points to manage your systems' lifetime:
- On demand by getting and setting it in the Services
- System as a [singleton script](#Statics-singletons-and-other-global-like-writes) with the `Start()` and `Cancel()`
- System as a [singleton script](#statics-singletons-and-other-globals) with the `Start()` and `Cancel()`
- Through your game's `BeginRun()` and `EndRun()`
- As a component processor when associated component types are added to the scene

Expand Down Expand Up @@ -246,4 +246,4 @@ One thing you may also consider is whether to simply merge the dependant object

* [Scheduling and priorities](scheduling-and-priorities.md)
* [Flexible processors](../engine/entity-component-system/flexible-processing.md)
* [Custom Assets](custom-assets.md)
* [Custom Assets](custom-assets.md)
14 changes: 11 additions & 3 deletions en/manual/scripts/custom-assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Here's how it looks like in a default game project:
</ItemGroup>
</Project>
```
>[!Warning]
> [!Warning]
> Make sure that the version specified for `Stride.Core.Assets` matches the other package's versions.
Inside the same project, create a new csharp file and replace its content with the following:
Expand Down Expand Up @@ -82,8 +82,12 @@ public sealed class YOUR_CLASS_COMPILER : AssetCompilerBase

public override IEnumerable<ObjectUrl> GetInputFiles(AssetItem assetItem)
{
// Yield asset items you are dependent on to include them in the build
// Yield assets that must be built before this one is built,
// this is for cases were you need to read from a compiled version of an asset to build this one.
// Note that creating cyclic references through this method will cause a deadlock when building
// (e.g.: A is input of B while B is input of A)
// below only for reference purposes, useless in this context
var asset = (YOUR_CLASS_ASSET)assetItem.Asset;
foreach (var block in asset.PrefabCollection)
{
Expand Down Expand Up @@ -116,6 +120,10 @@ public sealed class YOUR_CLASS_COMPILER : AssetCompilerBase
}
}
```

> [!Warning]
> Every changes made to the runtime asset will break previously built asset databases, make sure to delete the build artifacts stride generates for assets (`YOUR_PROJECT.Windows/obj/stride` and `bin/db`) after changing the class to make sure the asset database is fully rebuilt on the next build.
This takes care of the support for this asset, you could create a `*.blks` file inside your `Assets` directory and fill in the content manually, but might as well do it through the editor ...

## Adding a section for the Add asset menu inside the editor
Expand Down

0 comments on commit 30e4948

Please sign in to comment.