The Elixir Overlay is a feature that allows developers to integrate features like NFT purchasing and friends chat seamlessly into their game.
While the overlay is provided by Elixir Launcher in-game automatically without any additional setup requirements, to integrate all the features of the overlay in-game, some setup is required.
Initialization & Disposal
The overlay event buffer will be automatically initialized by the SDK upon a call to PrepareElixir(apiKey).
The event buffer will remain initialized until application shutdown.
Integration
Here is a minimal example:
usingElixir;usingEvent=Elixir.Overlay.Event;publicclassTestOverlayController:MonoBehaviour{ // ... we will assume that a method Log is implemented that prints // text on-screen. // To initialize simply initialize the SDK by calling PrepareElixirpublicvoidInit() {ElixirController.Instance.PrepareElixir("your api public key here"); // after the SDK is initialized, you can assign to the delegatesEvent.OnCheckoutResult+= HandleCheckoutResult;Event.OnOpenStateChange+= HandleOpenStateChange; }privatevoidHandleOpenStateChange(bool isOpen) {Log($"MOpenStateChange: {isOpen}"); }privatevoidHandleCheckoutResult(bool success,string sku) {Log($"MCheckoutResult: {success}"); }}