Skip to content

2. Quick start

one-nora edited this page May 10, 2026 · 2 revisions

First, we need to access the API by creating a WKLibAPI instance.

This instance is the main entry point for WKLib. Through it, you can create, save, and load configs, load assets, create UI, etc.

Creating an instance

An API instance can be created using either of these methods

WKLibAPI.Create(string displayName, string guid)
WKLibAPI.Create(string displayName, string guid, string defaultConfigFileName)

Examples

// ... Somewhere easily accessible (like your plugin class)
public static WKLibAPI WKLibAPI = WKLibAPI.Create("My mod", "my.mod.guid");

You can also choose the default config file name

public static WKLibAPI WKLibAPI = WKLibAPI.Create("My Mod", "my.mod.guid", "Settings");

You can destroy the current instance when it is no longer needed.
It is recommended to call this during your plugin cleanup, typically inside OnDestroy.

private void OnDestroy()
{
    WKLibAPI.Destroy();
}

Members

  • DisplayName API display name
  • GUID API identifier
  • Windows registered WKLibWindow instances
  • ModTab optional custom mod tab
  • ConfigFolder API config folder
  • DefaultConfigFile default config file
  • AssetService asset service instance

Methods

  • AddWindow(WKLibWindow window) registers a window if it is not already present
  • AddToModList(ModTab modTab) assigns a mod tab, only 1 mod tab can be set
  • Destroy() removes the API from the internal registry

Notes

  • GUIDs must be unique.
  • There can only be 1 mod tab per instance.
  • The default config file name defaults to DefaultConfig.
  • The constructor is private.

Clone this wiki locally