Skip to documentation
LITHIUM
Guide 01

Build your first Lithium addon.

Create a discoverable addon, own its lifecycle and keep package identity explicit from the first file.

Before you begin

Lithium runs inside an s&box project. Make the Lithium game library available to the project that compiles your addon, then keep the addon in its own namespace and package.

The current runtime discovers mounted addon packages and initializes public, concrete addon types during scene startup.

  • A working s&box project with C# enabled.
  • Lithium available as a project or library dependency.
  • A package identity that stays consistent with your Addon attribute.

Create the addon entry point

Derive a public sealed class from Addon and decorate it with Addon. The id is the durable package identity; the name is the human-readable label exposed by the manifest.

WeatherAddon.cs
using Lithium.Addons;

namespace YourStudio.Weather;

[Addon("yourstudio.weather", "Weather")]
public sealed class WeatherAddon : Addon
{
    protected override void OnAddonLoaded()
    {
        Log.Info("Weather addon loaded");
    }

    protected override void OnAddonUnloaded()
    {
        Log.Info("Weather addon unloaded");
    }
}

Add a runtime feature

Keep the addon class focused on composition. Put scene behavior in Components or ComponentService types, then create or configure them from the addon lifecycle.

Cette page vous a-t-elle aidé ?

N’indiquez aucune donnée personnelle dans votre commentaire.

0/1000