menu_bookDocumentation

Game Mounts: Creating Custom Asset Mounts for External Games

calendar_today May 20, 2026 schedule ~1 min read person PatrickJr verified 50

The s&box mount system is extensible — anyone can write a mount to add support for a new game or engine. A mount detects a game's install directory via Steam, scans files, and converts assets into s&box compatible formats at runtime.

Key Classes

  • BaseGameMount — detects the game and registers assets during mount
  • ResourceLoader — loads and converts individual assets on demand

Creating a Game Mount

CSHARP
public class MyGameMount : BaseGameMount
{
    public override string Ident => "rust";
    public override string Title => "Rust";
    private string GameDir;

    protected override void Initialize( InitializeContext context )
    {
        if ( !context.IsAppInstalled( 252490 ) ) return;
        GameDir = context.GetAppDirectory( 252490 );
        IsInstalled = true;
    }

    protected override Task Mount( MountContext context )
    {
        foreach ( var file in Directory.GetFiles( GameDir, "*.mymodel", SearchOption.AllDirectories ) )
        {
            var relative = Path.GetRelativePath( GameDir, file );
            context.Add( ResourceType.Model, relative, new MyModelLoader( this, file ) );
        }
        IsMounted = true;
        return Task.CompletedTask;
    }
}

Resource Loaders

Resources load lazily — Load() is only called when the asset is used:
CSHARP
public class MyModelLoader : ResourceLoader<MyGameMount>
{
    private string FilePath;
    public MyModelLoader( MyGameMount host, string path ) { FilePath = path; }
    protected override object Load() => ConvertToModel( File.ReadAllBytes( FilePath ) );
}

Resource Types

Model (.vmdl), Texture (.vtex), Material (.vmat), Sound (.vsnd), Scene (.scene), PrefabFile (.prefab).
Was this helpful?