- When in the /.openapi-generator/ folder, run
npm run generate
- This will generate the cpp files in the /Source/PlayerClient/ folder.
- Additionally, it will run
generate-unreal-header.mjs
if you have node.js installed which will create a header file at /BeamSdk/Public/BeamPlayerClientAPI.h
An example implementation compatible with versions of Unreal newer than 5.2.1 is provided at: beam-sdk-unreal-example
Initialize a BeamClient to interact with the Beam API.
BeamStorage = UBeamSaveGameStorage::LoadOrCreate();
BeamClient = NewObject<UBeamClient>(this)
->SetBeamApiKey(BeamApiKey) // Required
->SetEnvironment(EBeamEnvironment::Testnet) // Optional, defaults to testnet if not set
->SetDebugLogging(true) // Optional, defaults to false if not set
->SetStorage(BeamStorage); // Required: Defaults to an Unreal SaveGame if you don't provide your own implementation
BeamStorage->Save();
BeamClient->GetActiveSessionAsync(EntityId, ChainId)
.Next([&, Callback](const BeamOperationResult& Response) {
// Do something with response
});
BeamClient->CreateSessionAsync(EntityId)
.Next([&, Callback](const BeamSessionResult& Response) {
// Do something with response
});
BeamClient->RevokeSessionAsync(EntityId, SessionAddress)
.Next([&, Callback](const BeamOperationResult& Response) {
// Do something with response
});