Player Authentication
ReneVerse Gamer Account Abstraction module.
ReneAPICreds
ReneAPICreds
The ReneAPICreds
class stores your ReneVerse API credentials.
Fields
The following fields are available in the ReneAPICreds
class:
APIKey
- Your ReneVerse API Key.PrivateKey
- Your ReneVerse Private Key.GameID
- Your ReneVerse Game ID.HostName
- Your ReneVerse Host Name.
ReneAPIManager
ReneAPIManager
The ReneAPIManager
class is used to initialize the ReneVerse API and connect to the ReneVerse game.
Init()
Init()
The Init()
method initializes the ReneVerse API.
GameConnect()
GameConnect()
ReneAPIManager.GameConnect(emailInputField.text, _onGraphQlHttpRequestException)
connects the user to the game by making an asynchronous call to the GameConnect
method of the ReneAPIManager
class. This method takes in the email (should be registered on the ReneVerse service) input field text and an optional callback function to handle GraphQL HTTP request exceptions. The boolean value connectedGame
is returned if the connection is successful.
reneApi.IsAuthorized()
reneApi.IsAuthorized()
reneApi.IsAuthorized()
is a method of the API
class that returns a boolean value indicating if the user is authorized to access the API.
Connect() example method
Summing up everything mentioned above the following method could be created to connect to our services to use the assets in your awesome games
}
Extensions
The Extensions
class contains some handy extension methods you can use in your Unity project.
SeparateCamelCase()
SeparateCamelCase()
The SeparateCamelCase()
method separates camel case strings.
UnderscoresToSpaces()
UnderscoresToSpaces()
The UnderscoresToSpaces()
method replaces underscores with spaces.
ToLoginUrl()
ToLoginUrl()
The ToLoginUrl()
method creates a login URL.
AddEnterYour()
AddEnterYour()
The AddEnterYour()
method adds "Enter your" to a string.
GetName()
GetName()
The GetName()
method gets the name of a member.
Conclusion
Congratulations! You have successfully learned how to use the ReneVerse Unity SDK to integrate NFTs into your Unity games. Now it's time to start building amazing games with the power of the blockchain! Happy coding!
ReneAPICreds
ReneAPICreds
The ReneAPICreds
class stores your ReneVerse API credentials.
Fields
The following fields are available in the ReneAPICreds
class:
APIKey
- Your ReneVerse API Key.PrivateKey
- Your ReneVerse Private Key.GameID
- Your ReneVerse Game ID.
ReneAPIManager
ReneAPIManager
The ReneAPIManager
class is used to initialize the ReneVerse API and connect to the ReneVerse game.
API()
API()
The API()
method returns the ReneVerse API client.
GameConnect()
GameConnect()
connects the user to the game by making an asynchronous call to the GameConnect method of the ReneAPIManager class. This method takes in the email (should be registered on the ReneVerse service) input field text and an optional callback function to handle GraphQL HTTP request exceptions. The boolean value connectedGame is returned if the connection is successful.
Getting the Assets
Getting the Assets
Afterwards you have many ways to implement loaded from ReneVerse service information about users' Assets and here is one of them. We can use Coroutines since they are Unity specific and less error prone:
As you remember we are waiting for the user to accept his entry into the ReneVerse system and to get an access to their assets. In order to achieve this you could do the following
Now let's look at the GetUserAssetsAsync(reneApi) method that has the necessary information in it
Here is mine and indeed the name of the Attribute is "Style"
You set this values once you create assets and can modify them in this menu
An example of Asset entity
An example of Asset entity
Here is how Asset class is set up in our case but it is up to you how you hook up the retrieved information within your game.
Congratulations! You have successfully learned how to use the ReneVerse Unity SDK to integrate NFTs into your Unity games. Now it's time to start building amazing games with the power of the blockchain! Happy coding!
Last updated