Class ScriptContainerExtension
Base class for script-level Unity container extensions used in Aura scripting.
Implements
Inherited Members
Namespace: EyeAuras.Scripting.Api
Assembly: EyeAuras.Scripting.Metadata.dll
Syntax
public abstract class ScriptContainerExtension : UnityContainerExtension, IUnityContainerExtensionConfigurator
Remarks
This extension allows script authors to declaratively register their own types into the dependency injection container
used within an Unity.Extension.UnityContainerExtension context. By inheriting from ScriptContainerExtension
, a script
can publish its services (such as helper classes, singletons, utilities, or shared state) for consumption by other scripts.
This pattern ensures that script services are isolated, discoverable, and optionally reusable across scripts without hard references or global registration. The Unity container used is scoped per script or script context.
This base type is recognized and automatically loaded by the Aura runtime during script compilation if present in a script assembly. To avoid unnecessary container extensions being applied, the loader will only apply extensions that inherit from this base type.
Examples
Below is a simple example where a script registers a shared singleton:
public class Registrations : ScriptContainerExtension
{
protected override void Initialize()
{
Container.RegisterSingleton<ICombatState, CombatState>();
}
}
This allows another script in the same runtime to use:
public class MyScript
{
public MyScript(ICombatState combatState)
{
combatState.StartAttack();
}
}
Constructors
Name | Description |
---|---|
ScriptContainerExtension() |