Class OfsPlugin
- Namespace
- Ofs
- Assembly
- Ofs.Api.dll
Base class for every ofs-ng plugin. Derive from it and override only what you need. The single required member is Name.
public abstract class OfsPlugin
- Inheritance
-
objectOfsPlugin
Properties
Host
The host. Available from OnLoad() onward; never null inside callbacks.
protected IOfsHost Host { get; }
Property Value
Name
Display name shown in the plugin list. Required.
public abstract string Name { get; }
Property Value
Methods
OnLoad()
Called once after the plugin is constructed and the host is wired. Register shortcuts, nodes, and event subscriptions here.
protected virtual void OnLoad()
OnRenderUi(Ui)
Called every frame on the main thread to draw the plugin window. Override only if the plugin has UI. Not overriding it means "no window".
protected virtual void OnRenderUi(Ui ui)
Parameters
uiUi
OnUnload()
Called once before the plugin is unloaded. Stop threads, dispose resources. Event subscriptions made through Host are dropped automatically. Any background work that outlives this call must observe UnloadToken (cancelled right after OnUnload returns) — a thread or timer left running will keep the plugin assembly loaded and its DLL locked.
protected virtual void OnUnload()
OnUpdate(float)
Called every frame on the main thread before rendering. Override for per-frame logic. Queued work from background threads runs before this.
protected virtual void OnUpdate(float deltaSeconds)
Parameters
deltaSecondsfloat