Before you start
SDK walk-through
Components interaction
Mirage SDK enables interacting with the blockchain for the latest Unreal Engine 5+.
The interaction components are the following:
- Frontend: Unreal Engine 5+
- Backend:
- Unreal Engine uses Mirage API to interact with the blockchain.
- Mirage handles the Unreal Engine to blockchain communication.
SDK's functionality
Currently, the SDK supports the following functionality for Unreal Engine:
- Connecting a wallet (MetaMask) and authenticating a user.
- Updating NFTs.
- Minting NFTs.
Prerequisites
- Having smart contracts deployed on the blockchain.
- Having smart contract addresses and ABI for those smart contracts deployed.
SDK Installation
- Download the
MirageSDK.zip
package from the latest release. - Unzip the
MirageSDK.zip
package to your Unreal Project's Plugins folder. - Delete the Binaries, Intermediate, and Saved folders.
- Right-click
.uproject
and then select Generate Visual Studio project (or Services > Generate Xcode project) to generate either of those. - Open the generated Visual Studio (or Xcode) project and check if the plugin is included inside the Game project.
- Locate your
GameInstance.h
if already created. If not, add the C++ class from Content Browser in Unreal Engine, check Show All Classes and select GameInstance. Name your class MyGameInstance. - Open
MyGameInstance.h
and include the following code:#include "MirageClient.h" UPROPERTY() UMirageClient* mirageClient; UFUNCTION(BlueprintCallable, Category = "MIRAGE SDK") UMirageClient* GetMirageClient();
- Open
MyGameInstance.cpp
and include the following code:UMirageClient* UMyGameInstance::GetMirageClient() { if (mirageClient == nullptr) { mirageClient = NewObject<UMirageClient>(); } return mirageClient; }
- Add MirageSDK to your Unreal Project/Source/Unreal
Project/Build.cs
as follows:PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "MirageSDK" });
- Click Edit > Project Settings > Maps and Modes, and select your newly created or already created GameInstance from the GameInstance Class dropdown.
- Now you can call all the functions in the blueprint by getting GetGameInstance > GetMirageClient.