Getting Started
Welcome to C4G! This guide will help you get started with managing your game configurations through Google Sheets.
What is C4G?
C4G (Configs for Games) is a production-ready toolset that enables you to manage your Unity game configurations through Google Sheets. It automatically generates C# DTO classes and serializes your configurations to JSON, making configuration management simple and accessible to non-programmers.
Prerequisites
Before you begin, ensure you have:
- Unity 2019.4 or later
- A Google account for Google Sheets
- Basic understanding of Unity and C#
For detailed requirements, see Supported Versions.
Installation
For complete installation instructions, see the Installation Guide.
Quick Install:
- Download the latest
.unitypackagefrom GitHub Releases - In Unity:
Assets → Import Package → Custom Package - Select the downloaded file and click
Import
Quick Start
1. Set Up Google Sheets API
Configure OAuth 2.0 credentials to access your Google Sheets:
- Create a Google Cloud project
- Enable the Google Sheets API
- Create OAuth 2.0 credentials
- Download credentials JSON file
Full guide: OAuth 2.0 Setup
2. Configure C4G in Unity
- Open
Window → C4G → Settings - Enter your Google Sheets ID
- Set path to credentials JSON file
- Configure output folders for generated code and configs
Full guide: Editor Workflow
3. Create Your First Config Sheet
Structure your Google Sheet with this format:
| FieldName | FieldType | Values1 | Values2 | Values3 |
|---|---|---|---|---|
| id | int | 1 | 2 | 3 |
| name | string | Sword | Shield | Potion |
| price | float | 100.5 | 200.0 | 50.75 |
Full guide: Google Sheets Setup
4. Generate Code and Configs
- Open
Window → C4G → Generate - Click
Generate Configs - C4G automatically:
- Fetches data from Google Sheets
- Generates C# DTO classes
- Serializes data to JSON
5. Use in Your Game
using C4G.Runtime;
using UnityEngine;
public class ConfigExample : MonoBehaviour
{
void Start()
{
// Load your generated config
var config = Resources.Load<TextAsset>("Configs/YourConfig");
var data = JsonUtility.FromJson<YourConfig>(config.text);
Debug.Log($"Loaded {data.items.Length} items");
}
}
Next Steps
Now that you've completed the quick start, explore these topics:
- Installation Guide - Detailed installation and setup
- OAuth 2.0 Setup - Complete OAuth configuration
- Google Sheets Setup - Learn sheet structure and best practices
- Editor Workflow - Master C4G in Unity Editor
- Supported Versions - Check compatibility
- API Reference - Understand C4G's API