Xerial Services

The XerialServices script is a Unity component designed to facilitate interaction with Xerial services within Unity projects.

Initialization

To use the XerialServices script in your Unity project, follow these steps:

using UnityEngine;

namespace Xerial
{
    public class XerialServices : MonoBehaviour
    {
        public static XerialServices instance;
        
        void Awake()
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
            
            sessionManager = new SessionManager();
            walletManager = new WalletManager();
            inventoryManager = new InventoryManager();
            marketPlaceManager = new MarketPlaceManager();
            socialRedirecter = new SocialRedirecter();

        }
    }
}

Configuration

Environment

The Enviroment enum allows you to specify the environment for interacting with Xerial services. It includes the following options :

  • development: Development environment.

  • staging: Staging environment.

  • production: Production environment.

The environment can be set via the Unity Inspector or through script.

API URLs

The apiURL property retrieves the API URL based on the selected environment. The URL is automatically configured according to the environment specified.

Wallet URLs

The walletURL property retrieves the wallet API URL based on the selected environment.

Blockchain Selection

The Blockchain enum enables you to select the blockchain network for Xerial services. It includes the following options and any EVM compatible:

  • Polygon

  • Telos

  • Kroma

The selected blockchain can be accessed via the Chain property, which returns the corresponding string representation of the blockchain.

Properties

  • ProjectId: Retrieves the project ID associated with the Xerial services.

  • StudioAddress: Retrieves the studio address configured for the project.

  • Domain: Retrieves the domain associated with the project's website.

Initialization

The XerialServices script initializes necessary components upon Awake, ensuring proper functionality throughout the Unity project.

Last updated