Built to Last. Built for Play. A comprehensive Web3 gaming ecosystem that combines NFTs, on-chain assets, and Play-to-Earn (P2E) mechanics.
The LithosProtocol Unity SDK provides seamless integration between Unity games and the LithosProtocol blockchain. This SDK allows game developers to easily interact with smart contracts, manage player data, handle NFTs, and process transactions.
git clone https://github.com/DevelApp-ai/LithosProtocol.git
cd LithosProtocol/unity
Download the latest release from GitHub and import the unity folder into your Unity project’s Assets folder.
unity folder to your Unity project’s Assets directoryCreate a configuration script or use the default settings:
using LithosProtocol.Unity;
public class GameConfig : MonoBehaviour
{
public string RpcUrl = "https://sepolia.infura.io/v3/YOUR_INFURA_KEY";
public int ChainId = 11155111; // Sepolia
public string GovernanceTokenAddress = "0x...";
public string UtilityTokenAddress = "0x...";
// ... other contract addresses
}
using LithosProtocol.Unity;
using UnityEngine;
public class BlockchainManager : MonoBehaviour
{
private LithosProtocolUnity _lithos;
async void Start()
{
// Initialize with default configuration
_lithos = new LithosProtocolUnity();
// Or with custom configuration
var config = new LithosConfig
{
Network = Network.Sepolia,
RpcUrl = "https://sepolia.infura.io/v3/YOUR_INFURA_KEY",
ContractAddresses = new ContractAddresses
{
GovernanceToken = "0x...",
UtilityToken = "0x...",
// ... other addresses
}
};
await _lithos.Initialize(config);
// Connect wallet
await _lithos.ConnectWallet();
}
}
```csharp // Register a new player string txHash = await lithos.Player.RegisterPlayer(“0x”); // referrer address
// Get player data var playerData = await lithos.Player.GetPlayerData(); Debug.Log($