Transform your Unity games with seamless EpicChain blockchain integration. Build next-generation Web3 games with NFTs, smart contracts, and decentralized economies.
The EpicChain Unity SDK is a powerful, production-ready toolkit designed specifically for Unity game developers who want to integrate blockchain technology into their games. Whether you're building an NFT marketplace, a play-to-earn economy, or a decentralized multiplayer experience, this SDK provides everything you need to connect your Unity project with the EpicChain blockchain.
- ✅ Native Unity Integration - Built from the ground up for Unity's architecture
- ✅ Production Ready - Battle-tested in real-world gaming applications
- ✅ Developer Friendly - Intuitive API with extensive documentation
- ✅ Cross-Platform - Works on Mobile, Desktop, WebGL, and Console
- ✅ Performance Optimized - Minimal overhead and efficient resource usage
- ✅ Open Source - MIT licensed with active community support
Experience enterprise-grade wallet functionality with comprehensive security features:
- XEP-6 Wallet Standard - Full compliance with EpicChain wallet specifications
- BIP-39 Mnemonic Generation - Create human-readable backup phrases
- Multi-Signature Accounts - Support for complex authorization schemes
- Hardware Wallet Support - Integration with Ledger and other hardware wallets
- WIF Import/Export - Standard wallet interchange format support
- Secure Key Storage - Encrypted local storage with password protection
- HD Wallet Support - Hierarchical deterministic wallet generation
- Watch-Only Addresses - Monitor addresses without private key access
// Example: Create a secure wallet with mnemonic
var mnemonic = Wallet.GenerateMnemonic();
var wallet = Wallet.CreateFromMnemonic(mnemonic, "SecurePassword123");
Debug.Log($"Wallet Address: {wallet.GetDefaultAccount().Address}");
Debug.Log($"Backup Phrase: {mnemonic}");Interact with smart contracts effortlessly using our intuitive API:
- Contract Deployment - Deploy new contracts directly from Unity
- XEP-17 Token Operations - Full fungible token standard support
- XEP-11 NFT Integration - Create, mint, and manage NFTs
- Native Contract Support - Built-in support for EpicChain system contracts
- Custom Contract Interaction - Call any method on any contract
- Event Monitoring - Real-time blockchain event notifications
- EpicPulse Optimization - Automatic epicpulse estimation and optimization
- Batch Operations - Execute multiple contract calls efficiently
// Example: Mint an NFT
var nftContract = new XEP11Contract("0x123abc...");
var tokenId = await nftContract.Mint(
ownerAddress: playerAddress,
metadata: new NFTMetadata {
Name = "Epic Sword",
Description = "Legendary weapon",
Image = "ipfs://..."
}
);Designed specifically for Unity workflows and best practices:
- MonoBehaviour Components - Drag-and-drop blockchain integration
- ScriptableObject Configuration - Visual network and contract setup
- Coroutine-Based Async - Seamless integration with Unity's async patterns
- Inspector Integration - Configure everything in the Unity Inspector
- Prefab Templates - Pre-built components for common use cases
- Unity Events - Native event system integration
- Custom Editors - Beautiful custom inspectors for blockchain data
- Gizmos & Debugging - Visual debugging tools for blockchain operations
// Example: Unity Component Integration
public class PlayerInventory : MonoBehaviour
{
[SerializeField] private XEP11ContractReference nftContract;
private void Start()
{
StartCoroutine(LoadPlayerNFTs());
}
private IEnumerator LoadPlayerNFTs()
{
yield return nftContract.GetTokensOfOwner(playerAddress, OnNFTsLoaded);
}
}Optimized for real-time gaming performance:
- Thread-Safe Operations - Safe concurrent blockchain interactions
- Connection Pooling - Efficient RPC connection management
- Caching System - Smart caching for frequently accessed data
- Batch Processing - Group operations for optimal throughput
- Memory Management - Minimal garbage collection impact
- Progressive Loading - Load blockchain data without frame drops
- Background Processing - Heavy operations on background threads
- WebGL Optimization - Special optimizations for browser deployment
Connect to any EpicChain network with ease:
- MainNet Support - Production blockchain deployment
- TestNet Support - Safe testing environment
- Private Networks - Connect to custom EpicChain networks
- Multiple RPC Endpoints - Automatic failover and load balancing
- Network Switching - Dynamic network changes at runtime
- Custom EpicPulse Tokens - Support for alternative epicpulse payment methods
Before you begin, ensure you have:
- Unity 2021.3 LTS or later installed
- Basic C# knowledge for scripting
- EpicChain wallet (optional, for testing)
- Internet connection for blockchain access
- Open your Unity project
- Navigate to
Window → Package Manager - Click the
+button in the top-left corner - Select
Add package from git URL - Enter:
https://github.com/epicchainlabs/epicchain-unity-sdk.git - Click
Addand wait for installation to complete
- Open your project's
Packages/manifest.jsonfile - Add the following to the
dependenciessection:
{
"dependencies": {
"com.epicchain.unity-sdk": "https://github.com/epicchainlabs/epicchain-unity-sdk.git#1.0.0",
"com.unity.nuget.newtonsoft-json": "3.2.1"
}
}- Save the file and return to Unity to trigger the installation
- Download the latest release from GitHub Releases
- Extract the archive to your project's
Assets/Plugins/folder - Wait for Unity to import the package
- In Unity, right-click in the Project window
- Navigate to
Create → EpicChain → SDK Configuration - Name it
EpicChainConfig - Configure the settings in the Inspector:
Create a new C# script called BlockchainManager.cs:
using EpicChain.Unity.SDK;
using EpicChain.Unity.SDK.Wallet;
using UnityEngine;
using System.Threading.Tasks;
public class BlockchainManager : MonoBehaviour
{
[Header("Configuration")]
[SerializeField] private EpicChainUnityConfig config;
[Header("UI References")]
[SerializeField] private TMPro.TextMeshProUGUI statusText;
[SerializeField] private TMPro.TextMeshProUGUI addressText;
[SerializeField] private TMPro.TextMeshProUGUI balanceText;
private Wallet playerWallet;
async void Start()
{
await InitializeBlockchain();
}
private async Task InitializeBlockchain()
{
try
{
UpdateStatus("Connecting to EpicChain...");
// Initialize the SDK
await EpicChainUnity.Instance.Initialize(config);
UpdateStatus("Creating wallet...");
// Create or load wallet
playerWallet = await LoadOrCreateWallet();
// Display wallet info
var account = playerWallet.GetDefaultAccount();
addressText.text = $"Address: {account.Address}";
// Check balance
await UpdateBalance();
UpdateStatus("Connected successfully!");
}
catch (System.Exception ex)
{
UpdateStatus($"Error: {ex.Message}");
Debug.LogError($"Blockchain initialization failed: {ex}");
}
}
private async Task<Wallet> LoadOrCreateWallet()
{
// Try to load existing wallet
if (PlayerPrefs.HasKey("WalletData"))
{
string walletJson = PlayerPrefs.GetString("WalletData");
string password = "YourSecurePassword"; // Use proper password management
return Wallet.FromJson(walletJson, password);
}
// Create new wallet
var newWallet = Wallet.Create();
// Save wallet (encrypted)
string password = "YourSecurePassword";
string walletJson = newWallet.ToJson(password);
PlayerPrefs.SetString("WalletData", walletJson);
PlayerPrefs.Save();
return newWallet;
}
private async Task UpdateBalance()
{
var account = playerWallet.GetDefaultAccount();
var balance = await EpicChainUnity.Instance.GetEpicChainBalance(account.Address);
balanceText.text = $"XPR Balance: {balance:F8}";
}
private void UpdateStatus(string message)
{
if (statusText != null)
statusText.text = message;
Debug.Log($"[Blockchain] {message}");
}
public async void OnTransferButtonClicked()
{
// Example: Transfer tokens
try
{
UpdateStatus("Sending transaction...");
var txHash = await EpicChainUnity.Instance.TransferEpicChain(
from: playerWallet.GetDefaultAccount(),
to: "NRecipientAddressHere",
amount: 1.0m
);
UpdateStatus($"Transaction sent: {txHash}");
// Wait for confirmation
await Task.Delay(15000); // Wait ~15 seconds
await UpdateBalance();
}
catch (System.Exception ex)
{
UpdateStatus($"Transfer failed: {ex.Message}");
}
}
}- Create a new GameObject in your scene:
GameObject → Create Empty - Name it
BlockchainManager - Add the
BlockchainManagerscript to it - Assign the
EpicChainConfigasset to the script's config field - Create UI elements (TextMeshPro texts) and assign them to the script
- Press Play in Unity
- Check the Console for connection messages
- Verify that a wallet address appears in your UI
- Check that the balance is displayed correctly
Learn by example with our comprehensive sample projects:
A complete marketplace implementation featuring:
Core Features:
- NFT Minting System - Create unique in-game items as NFTs
- Auction Mechanics - Time-based bidding with automatic settlement
- Direct Trading - Peer-to-peer item exchange
- Collection Management - Browse, filter, and sort NFTs
- Price Discovery - Real-time market pricing
- Transaction History - Complete audit trail of all trades
- Royalty System - Creator royalties on secondary sales
Technical Implementation:
- XEP-11 NFT contract integration
- Metadata storage on IPFS
- Real-time price updates
- Transaction signing and verification
- Event-driven UI updates
// Example: List NFT for sale
public async Task ListNFTForSale(string tokenId, decimal price)
{
var marketplace = new MarketplaceContract(marketplaceAddress);
await marketplace.ListItem(
tokenId: tokenId,
price: price,
seller: playerWallet.GetDefaultAccount()
);
}Location: Samples~/NFTMarketplace/
A full-featured RPG showcasing advanced blockchain integration:
Game Features:
- Character NFTs - Unique characters stored on-chain
- Equipment System - NFT weapons, armor, and accessories
- Skill Progression - Blockchain-verified character stats
- Guild System - Decentralized player organizations
- Quest Rewards - Token and NFT rewards
- Crafting System - Combine items to create new NFTs
- Trading Post - Player-to-player economy
Blockchain Features:
- Multi-signature guild treasury
- On-chain achievement system
- Provably fair loot drops
- Cross-game item compatibility
- Permanent character ownership
// Example: Level up character
public async Task LevelUpCharacter(string characterNFT)
{
var rpgContract = new RPGContract(contractAddress);
await rpgContract.LevelUp(
tokenId: characterNFT,
player: playerWallet.GetDefaultAccount()
);
// Update local character data
await RefreshCharacterStats(characterNFT);
}Location: Samples~/BlockchainRPG/
Comprehensive wallet functionality demonstration:
Demonstrated Features:
- Wallet Creation - Generate new wallets with mnemonics
- Wallet Import - Import from WIF, JSON, or mnemonic
- Multi-Account Support - Manage multiple addresses
- Transaction Builder - Create and sign custom transactions
- Balance Tracking - Real-time balance updates
- Token Management - View and transfer XEP-17 tokens
- Transaction History - Browse past transactions
- Address Book - Save frequently used addresses
// Example: Import wallet from mnemonic
public Wallet ImportWalletFromMnemonic(string mnemonic, string password)
{
if (!Wallet.ValidateMnemonic(mnemonic))
{
throw new Exception("Invalid mnemonic phrase");
}
var wallet = Wallet.CreateFromMnemonic(mnemonic, password);
Debug.Log($"Wallet imported: {wallet.GetDefaultAccount().Address}");
return wallet;
}Location: Samples~/WalletDemo/
Demonstrating transparent, verifiable game mechanics:
Features:
- Blockchain-based random number generation
- Verifiable game outcomes
- Transparent loot box mechanics
- Fair matchmaking system
- Tamper-proof leaderboards
Location: Samples~/ProvablyFair/
EpicChain.Unity.SDK/
│
├── Runtime/
│ ├── Core/ # Core blockchain functionality
│ │ ├── EpicChainUnity.cs # Main SDK entry point
│ │ ├── NetworkClient.cs # RPC client implementation
│ │ └── TransactionBuilder.cs
│ │
│ ├── Contracts/ # Smart contract interactions
│ │ ├── ContractBase.cs # Base contract class
│ │ ├── XEP17Contract.cs # Fungible token standard
│ │ ├── XEP11Contract.cs # NFT standard
│ │ └── NativeContracts/ # Built-in system contracts
│ │
│ ├── Crypto/ # Cryptographic operations
│ │ ├── KeyPair.cs # Public/private key management
│ │ ├── Signature.cs # Digital signatures
│ │ └── Hash.cs # Hashing functions
│ │
│ ├── Wallet/ # Wallet management
│ │ ├── Wallet.cs # Main wallet class
│ │ ├── Account.cs # Account management
│ │ └── WalletStorage.cs # Secure storage
│ │
│ ├── Utils/ # Utility classes
│ │ ├── Serialization/ # JSON/binary serialization
│ │ ├── Encoding/ # Base58/Hex encoding
│ │ └── Extensions/ # C# extension methods
│ │
│ └── Components/ # Unity MonoBehaviour components
│ ├── BlockchainManager.cs
│ ├── WalletController.cs
│ └── ContractInteractor.cs
│
├── Editor/ # Unity Editor extensions
│ ├── ConfigurationEditor.cs # Custom inspectors
│ ├── WalletWindow.cs # Wallet management window
│ └── ContractDeployer.cs # Contract deployment tool
│
├── Samples~/ # Sample projects
│ ├── NFTMarketplace/
│ ├── BlockchainRPG/
│ └── WalletDemo/
│
├── Tests/ # Unit and integration tests
│ ├── Runtime/
│ └── Editor/
│
└── Documentation~/ # Documentation files
├── api-reference.md
├── unity-integration.md
└── tutorials/
The SDK implements several proven design patterns:
- Singleton Pattern - EpicChainUnity instance management
- Factory Pattern - Contract and wallet creation
- Observer Pattern - Blockchain event notifications
- Strategy Pattern - Pluggable network providers
- Repository Pattern - Data access abstraction
- Command Pattern - Transaction building
All SDK operations are thread-safe and work seamlessly with Unity's threading model:
- Main thread operations for Unity API calls
- Background threads for heavy cryptographic operations
- Async/await pattern for non-blocking operations
- Coroutine support for Unity-style async
Complete documentation for every class, method, and property:
- Core API - Main SDK functionality
- Wallet API - Wallet operations
- Contract API - Smart contract interaction
- Crypto API - Cryptographic functions
- Utility API - Helper functions
Step-by-step tutorials for common scenarios:
- Unity Integration - Best practices for Unity
- Wallet Management - Secure wallet handling
- Smart Contracts - Contract deployment and interaction
- NFT Creation - Minting and managing NFTs
- Token Economics - Implementing game economies
Deep dives into complex features:
- Performance Optimization - Maximize efficiency
- Security Best Practices - Protect user assets
- Network Architecture - RPC and connectivity
- EpicPulse Optimization - Minimize transaction costs
- Testing Strategies - Quality assurance
Visual learners can check out our video series:
- 🎥 Getting Started with EpicChain Unity SDK (15 min)
- 🎥 Building Your First Blockchain Game (45 min)
- 🎥 Advanced NFT Implementation (30 min)
- 🎥 Multiplayer Blockchain Integration (40 min)
For developers who want to contribute or customize:
# Clone the repository
git clone https://github.com/epicchainlabs/epicchain-unity-sdk.git
# Navigate to directory
cd epicchain-unity-sdk
# Open in Unity 2021.3 or later
# The project will automatically resolve dependencies- Unity 2021.3 LTS or later
- .NET Standard 2.1 support
- Newtonsoft JSON package (auto-installed)
- Git for version control
- Visual Studio or Rider (recommended IDEs)
Comprehensive test coverage ensures reliability:
# In Unity Editor
Window → General → Test Runner → Run All Tests
# Via command line
unity -runTests -batchmode -projectPath /path/to/project -testResults results.xmlTest Coverage:
- Unit tests for all core functionality
- Integration tests for blockchain operations
- Performance benchmarks
- Cross-platform compatibility tests
We maintain high code quality standards:
- Code Reviews - All PRs require approval
- Automated Testing - CI/CD pipeline validation
- Code Coverage - Minimum 80% coverage
- Documentation - XML docs for all public APIs
- Style Guide - Consistent C# coding conventions
We welcome contributions from the community! Here's how you can help:
- 🐛 Bug Reports - Found a bug? Let us know!
- ✨ Feature Requests - Have an idea? We'd love to hear it!
- 📝 Documentation - Help improve our docs
- 💻 Code Contributions - Submit pull requests
- 🧪 Testing - Help test new features
- 🌍 Translations - Translate documentation
-
Fork the Repository
git clone https://github.com/YOUR_USERNAME/epicchain-unity-sdk.git
-
Create a Feature Branch
git checkout -b feature/amazing-feature
-
Make Your Changes
- Write clean, documented code
- Follow existing code style
- Add tests for new features
-
Commit Your Changes
git commit -m "Add amazing feature" -
Push to Your Fork
git push origin feature/amazing-feature
-
Open a Pull Request
- Describe your changes clearly
- Reference any related issues
- Wait for review and feedback
Please follow these guidelines:
- Use meaningful variable and method names
- Add XML documentation comments
- Write unit tests for new functionality
- Follow C# naming conventions
- Keep methods focused and concise
- Handle errors appropriately
For full details, see our Contributing Guide.
Solution:
- Check your internet connection
- Verify the RPC endpoint URL is correct
- Try an alternative RPC endpoint
- Check firewall settings
Solution:
- Check wallet balance has enough XPR for epicpulse
- Ensure you're accounting for transaction fees
- For TestNet, request tokens from faucet
Solution:
- Verify contract address is correct
- Ensure you're connected to the right network
- Check if contract is deployed
Solution:
- Use WebGL compatibility mode in config
- Avoid synchronous blockchain calls
- Implement proper error handling
If you're stuck:
- Check our FAQ
- Search GitHub Issues
- Join our Discord
- Post on our Forum
- 💬 Discord - Join our server for real-time chat
- 🐦 Twitter - @EpicChainLabs for updates
- 📧 Email - support@epic-chain.org for direct support
- 📖 Forum - forum.epic-chain.org for discussions
- 📺 YouTube - EpicChain Labs for tutorials
- Developer Blog - Technical articles and updates
- Monthly Newsletter - Latest news and announcements
- Community Calls - Bi-weekly developer meetups
- Hackathons - Regular coding competitions with prizes
This project is licensed under the MIT License - see the LICENSE file for full details.
MIT License
Copyright (c) 2024 EpicChain Labs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
[Full license text...]
- ✅ Core wallet functionality
- ✅ Smart contract interaction
- ✅ XEP-17 token support
- ✅ XEP-11 NFT support
- ✅ Cross-platform compatibility
- 🔄 Advanced caching system
- 🔄 Offline transaction signing
- 🔄 Hardware wallet integration
- 🔄 Enhanced epicpulse estimation
- 🔄 Batch transaction optimization
- 📋 Layer 2 scaling solutions
- 📋 Cross-chain bridge support
- 📋 Advanced analytics dashboard
- 📋 Mobile-optimized UI components
- 📋 VR/AR blockchain integration
CryptoQuest RPG - A fully on-chain RPG with 10,000+ players
NFT Racers - Blockchain-based racing game with tradeable cars
MetaGuild - Decentralized guild management platform
Want your game featured here? Contact us!
- Official Website - Learn about EpicChain
- Developer Docs - Complete documentation
- Block Explorer - Explore the blockchain
- Faucet - Get test tokens
- Unity Documentation - Official Unity docs
- Unity Forum - Unity community forum
- Asset Store - Unity assets
- Visual Studio Code - Lightweight IDE
- Rider - Advanced Unity IDE
- Git - Version control
- Postman - API testing
Transform your game with blockchain technology today!
Get Started Now • View Samples • Join Community
Made with ❤️ by the EpicChain Labs Team
Building the future of blockchain gaming, one commit at a time.