Comment on page
Initialising the SDK
In this tutorial, we will initialise the ReadyNFT SDK which is a pre-requisite for using the other methods in the SDK
The
Init
method is a crucial step that needs to be called before using any other method in the ReadyNFT SDK. It is responsible for setting up the API key and game ID, which are essential for establishing the connection between your game and the ReadyNFT platform.Note: Ensure that you have obtained a valid API key and game ID from ReadyNFT before proceeding with the initialisation
public void Init(string _apiKey, string _gameId)
_apiKey
(string): The API key provided by ReadyNFT. It serves as a unique identifier for your game and authorizes the communication between your game and the ReadyNFT platform._gameId
(string): The game ID associated with your game on the ReadyNFT platform. It distinguishes your game from others and facilitates the retrieval of relevant data.
using UnityEngine;
public class ReadyNFTManager : MonoBehaviour
{
private const string apiKey = "your-api-key";
private const string gameId = "your-game-id";
void Start()
{
InitializeReadyNFT();
}
public void InitializeReadyNFT()
{
ReadyNFT readyNFT = new ReadyNFT();
readyNFT.Init(apiKey, gameId);
Debug.Log("ReadyNFT initialized!");
}
}
- Ensure that you call the
Init
method before attempting to use any other methods in the ReadyNFT SDK. Failing to do so may result in empty responses or unexpected behaviour. - Make sure to provide the correct API key and game ID obtained from ReadyNFT. Using incorrect or invalid credentials will prevent the successful initialisation of the SDK.
- It's recommended to perform the
Init
method within a suitable initialisation phase of your game, such as theStart
method of a game manager script or a designated initialisation script.
By correctly utilising the
Init
method and providing the appropriate API key and game ID, you establish a valid connection between your game and the ReadyNFT platform, enabling access to other methods and functionalities within the ReadyNFT SDK.