GameCloud-Unity is a Unity package that provides seamless integration with the GameCloud backend-as-a-service (BaaS) platform. Designed for game developers, it simplifies implementing cloud-based multiplayer features, player authentication, game state synchronization, and more in Unity projects.
β οΈ Note: This package is currently in development. APIs may change before the stable release.
-
Simplified API Integration
- Connect to the GameCloud backend with just a few lines of code
- Automatic serialization and deserialization of game data
- Comprehensive error handling and connection management
-
Optional UniTask Support
- Use standard C# Tasks or enable UniTask for better performance
- All async methods follow the
Async
naming convention - Memory-efficient asynchronous operations
-
Rich Multiplayer Functionality
- Matchmaking system integration
- Lobby management
- Turn-based game synchronization
- Real-time player statistics
-
Cross-Platform Compatibility
- Works on all platforms supported by Unity (including WebGL)
- Consistent API experience across platforms
- Platform-specific optimizations where needed
- Open the Package Manager window in Unity (Window > Package Manager)
- Click the "+" button in the top-left corner
- Select "Add package from git URL..."
- Enter:
https://github.com/turanheydarli/GameCloud-Unity.git
- Click "Add"
- Clone this repository:
git clone https://github.com/turanheydarli/GameCloud-Unity.git
- Copy the contents into your Unity project's
Packages
folder - Restart Unity if it's already running
Before using GameCloud-Unity, you need to configure your API credentials:
- Navigate to Edit > Project Settings > GameCloud
- Enter your API credentials from the GameCloud Developer Portal
- Configure additional settings like environment (Production/Staging) and timeout values
- Save the settings
To enable UniTask support:
- Add the UniTask package to your project
- Add the
UNITASK_SUPPORT
scripting define symbol in Project Settings > Player > Scripting Define Symbols
using GameCloud;
using UnityEngine;
using System.Threading.Tasks;
public class GameCloudExample : MonoBehaviour
{
private IGameCloudClient _client;
async void Start()
{
// Load settings from the project configuration
var settings = GameCloudSettings.Load();
// Initialize the GameCloud client with settings
_client = GameCloudClient.FromSettings(settings);
try {
// Connect to the GameCloud service
await _client.InitializeAsync();
Debug.Log("Successfully connected to GameCloud!");
// Create or join a game session
var session = await _client.Sessions.CreateOrJoinAsync("my-game-type");
Debug.Log($"Joined session: {session.Id}");
}
catch (GameCloudException ex) {
Debug.LogError($"GameCloud error: {ex.Message}");
}
}
}
If you're using VContainer for dependency injection:
using GameCloud;
using UnityEngine;
using VContainer;
using VContainer.Unity;
// Register GameCloud services in your LifetimeScope
public class GameLifetimeScope : LifetimeScope
{
protected override void Configure(IContainerBuilder builder)
{
// Load settings from the project configuration
var settings = GameCloudSettings.Load();
// Register GameCloud client as a service
builder.Register<IGameCloudClient>(r => GameCloudClient.FromSettings(settings), Lifetime.Singleton);
// Register other services that depend on GameCloud
builder.Register<IMatchmakingService, MatchmakingService>(Lifetime.Singleton);
builder.Register<IPlayerService, PlayerService>(Lifetime.Singleton);
// Register game managers
builder.RegisterEntryPoint<GameManager>();
}
}
GameCloud-Unity follows these naming conventions:
- All asynchronous methods have the
Async
suffix (e.g.,InitializeAsync()
,GetPlayerDataAsync()
) - Service interfaces begin with
I
(e.g.,IGameCloudClient
,IMatchmakingService
)
Interface | Description |
---|---|
IGameCloudClient |
Main client interface for interacting with GameCloud services |
ISessionService |
Manage multiplayer game sessions |
IMatchmakingService |
Find and create matches between players |
IPlayerService |
Handle player authentication and profiles |
ILobbyService |
Create and manage game lobbies |
Tutorial | Description |
---|---|
Getting Started | Set up the package and make your first API call |
UniTask Integration | Working with UniTask in GameCloud |
Turn-Based Multiplayer | Build a simple turn-based game with GameCloud |
WebGL Support | Special considerations for WebGL builds |
GameCloud-Unity/
βββ Documentation~/ - Documentation files
βββ Editor/ - Unity editor extensions
β βββ GameCloudSettings.cs - Settings provider
β βββ GameCloudWindow.cs - Debug window
βββ Runtime/ - Core runtime scripts
β βββ Api/ - API client implementations
β βββ Models/ - Data models
β βββ Interfaces/ - Core service interfaces
β βββ GameCloudClient.cs - Main client class
βββ Samples~/ - Example projects
β βββ BasicIntegration/
β βββ MultiplayerGame/
βββ Tests/ - Unit and integration tests
- Unity 2020.3 or higher
- .NET Standard 2.0 compatible project
- Internet connection for API communication
- GameCloud developer account (Sign up here)
Contributions are welcome! Here's how you can help improve the package:
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature
- Commit your changes:
git commit -m 'Add some amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
If you encounter any bugs or have feature requests, please open an issue on GitHub. Include as much detail as possible:
- Unity version
- Package version
- Steps to reproduce
- Expected vs. actual behavior
This project is licensed under the MIT License - see the LICENSE file for details.
- Turan Heydarli - GitHub