SheetX Essential Document
1. Introduction
This tool simplifies database design and management for game developers and designers, allowing for easy modification of configurations and statistics.
As projects grow, the need for efficient management of data tables, constants, and IDs increases. This tool centralizes the process, enabling easy searching, modification, and updates.
It supports various data types and utilizes popular spreadsheet tools for data management.
You can download Example Here
Preview the types of data supported by SheetX Here
2. Main functions
- Excel and Google Sheets Integration: Manage your entire database using Excel or Google Spreadsheets.
- ID and Constant Management: Make batch adjustments to IDs and constants without impacting the database.
- JSON Export: Convert data tables to JSON files for easy Unity integration.
- Flexible Data Formats: Support a variety of data formats, adaptable to your design needs.
3. Settings
Navigate to the main menu and select: Window > SheetX > Settings
- Scripts Output Folder: Stores exported C# scripts, including IDs and Constants.
- Json Output Folder: Stores exported JSON data.
- Namespace: Defines the namespace for the exported C# files.
- Separate IDs: Sheets
- TRUE: Exports [%IDs] sheets to individual C# files named [SheetName] + IDs.cs.
- FALSE: Merges all [%IDs] sheets from all Excel files into a single C# file named IDs.cs.
- Separate Constants: Sheets
- TRUE: Exports [%Constants] sheets to individual C# files named [SheetName] + %Constants.cs.
- FALSE: Merges all [%Constants] sheets from all Excel files into a single C# file named Constants.cs.
- Only enum as IDs: For [%IDs] sheets, columns with the extension [enum] will be exported as enums and will not include the Integer Constant form.
- Combine Json Sheets: Merges the Data Table from one Excel file into a single JSON file, named [ExcelName].txt.
- Persistent fields: By default, empty cells are excluded when exporting to JSON. If you wish to retain these empty cells, add the name of their columns into the Persistent Fields box.
- Google Client ID: Enter your Google Client ID (retrieved from Credentials in Google Console).
- Google Client Secret: Enter your Google Secret (retrieved from Credentials in Google Console).
4. Excel Sheets Exporter
4.1. Export Single Excel File
Navigate to the main menu and select: Window > SheetX > Excel Spreadsheets
This function is ideal for learning how to use the tools. It’s great for small, simple Static Databases that only need one Excel file for all the data.
Key Functions:
- Export IDs: Converts ID sheets to C# files.
- Export Constants: Converts Constants sheets to C# files.
- Export Json: Transforms Data Table sheets into JSON data.
- Export All: Performs all the functions with a single click.
4.2. Export multiple Excel Files
This feature is essential for managing complex Static Databases divided into multiple Excel files. It helps you efficiently handle and export all your files with one click:
- Add all the Excel files you want to process.
- For each Excel file, you have the option to choose which sheets to include or exclude.
- Press the Export All button to complete the process.
5. Google Spreadsheets
Prefer using Google Spreadsheets? No problem.
Navigate to the main menu and select: Window > SheetX > Google Spreadsheets
5.1. Setup Google Client ID and Client Secret
Copy the Client ID and Client Secret, and paste them into the corresponding settings in the Sheets Exporter Settings Window
5.2. Export single Google Spreadsheet
Enter the Google Sheet ID, then click the Download button. You can find the ID in the Google Sheet’s URL, formatted like this:
https://docs.google.com/spreadsheets/d/[GOOGLE_SHEET_ID]/edit?......
5.3. Export multiple Google Spreadsheets
Click on Add Google Spreadsheets, then enter the Google Sheet ID in the popup that appears. Press Download, then select the sheets you want to process.
6. Rules in Spreadsheet
6.1. IDs
Hero | Building | Pet | Gender[enum] | |||||||
---|---|---|---|---|---|---|---|---|---|---|
HERO_1 | 1 | comment | BUILDING_NULL | 0 | comment | PET_NULL | 0 | comment | GENDER_NONE | 0 |
HERO_2 | 2 | comment | BUILDING_1 | 1 | PET_1 | 1 | GENDER_MALE | 1 | ||
HERO_3 | 3 | comment | BUILDING_2 | 2 | PET_2 | 2 | GENDER_FEMALE | 2 | ||
BUILDING_3 | 3 | PET_3 | 3 | GENDER_HELICOPTER | 3 | |||||
BUILDING_4 | 4 | PET_4 | 4 | |||||||
BUILDING_5 | 5 | PET_5 | 5 | |||||||
BUILDING_6 | 6 | PET_6 | 6 | |||||||
BUILDING_7 | 7 | PET_7 | 7 | |||||||
BUILDING_8 | 8 |
ID Sheets, named with the suffix IDs
are used to compile all IDs into Integer Constants. The design rules are:
- The sheet name must end with
IDs
. - Only the Integer data type is allowed.
- Each group is organized in 3 consecutive columns.
- The first row contains the group name for easy reference.
- The first column holds the Key Name, and the next column holds the Key Value.
- Key Value must be an integer.
- By default, all IDs in a column will be exported as Integer Constants. Add the suffix [enum] to the group name to export them as an enum.
- To only export enums and skip Integer Constants, select
Only enum as IDs
in the Settings.
| Group | Key | Comment |
| ----- | --- | ------- |
6.2. Constants
Name | Type | Value | Comment |
---|---|---|---|
EXAMPLE_INT | int | 83 | Integer Example |
EXAMPLE_FLOAT | float | 1.021 | Float example |
EXAMPLE_STRING | string | 321fda | String example |
EXAMPLE_INT_ARRAY_1 | int-array | 4 | Integer array example |
EXAMPLE_INT_ARRAY_2 | int-array | 0:3:4:5 | Integer array example |
EXAMPLE_FLOAT_ARRAY_1 | float-array | 5 | FLoat array example |
EXAMPLE_FLOAT_ARRAY_2 | float-array | 5:1:1:3 | FLoat array example |
EXAMPLE_VECTOR2_1 | vector2 | 1:2 | Vector2 example |
EXAMPLE_VECTOR2_2 | vector2 | 1:2:3 | Vector2 example |
EXAMPLE_VECTOR3 | vector3 | 3:3:4 | Vector3 example |
EXAMPLE_REFERENCE_1 | int | HERO_1 | Integer example |
EXAMPLE_REFERENCE_2 | int-array | HERO_1 : HERO_2 | Integer array example |
EXAMPLE_REFERENCE_3 | int-array | HERO_1 | HERO_3 | Integer array example |
EXAMPLE_REFERENCE_4 | int-array | HERO_1 HERO_4 | Integer array example |
EXAMPLE_FORMULA_1 | int | =1*10*36 | Excel formula example |
EXAMPLE_FORMULA_2 | float | =1+2+3+4+5+6+7+8+9 | Excel formula example |
Constants Sheets, named with the suffix Constants
compile project constants. The design rules are:
- The sheet name must end with
Constants
. - There are four columns: Name, Type, Value, and Comment.
- Name: The name of the constant; must be continuous, without special characters.
- Type: The data type of the constant. Possible data types include:
int
,float
,bool
,string
,int-array
,float-array
,vector2
, andvector3
. - Value: The value matching the data type. For array types, separate elements with
:
or|
ornewline
.
| Name | Type | Value | Comment |
| ---- | ---- | ----- | ------- |
6.3. Data table - JSON Data
Basic data type: Boolean, Number, String
numberExample1 | numberExample2 | numberExample3 | boolExample | stringExample |
---|---|---|---|---|
1 | 10 | 1.2 | TRUE | text |
2 | 20 | 3.1 | TRUE | text |
3 | BUILDING_8 | 5 | FALSE | text |
6 | HERO_3 | 10.7 | FALSE | text |
9 | PET_2 | 16.4 | FALSE | text |
Extended data type: Array, JSON object
array1[] | array2[] | array3[] | array4[] | array5[] | array6[] | JSON{} |
---|---|---|---|---|---|---|
text1 | 1 | 1 | TRUE | 123 66 |
aaa ccc |
{} |
text2 | 2 | 2 | 3 | 1 | 2 | 3 | TRUE | FALSE | TRUE | 123 71 |
aaa ccc |
{“id”:1, “name”:”John Doe 1”} |
text1 | text2 | 1 | 2 | 1 | BUILDING_2 | TRUE | FALSE | 123 67 |
aaa ccc |
{“id”:2, “name”:”John Doe 2”} |
text1 | text2 | text3 | 1 | 2 | 3 | BUILDING_1 | HERO_2 | TRUE | FALSE | TRUE | 123 68 |
aaa ccc |
{“id”:HERO_2, “name”:”JohnDoe 2”} |
text3 | 4 | 2 | BUILDING_3 | HERO_1 | HERO_2 | TRUE | FALSE | 123 76 |
aaa ccc |
[{“id”:HERO_1, “name”:”John Doe 1”},{“id”:HERO_2, “name”:”Mary Sue 2”}] |
text1 | text2 | text7 | 5 | 1 | 2 | 4 | PET_5 | TRUE | 123 78 |
aaa ccc |
[{“id”:HERO_1, “name”:”John Doe 1”},{“id”:HERO_2, “name”:”Mary Sue 2”}] |
- For array types, the column name must end with
[]
. - For JSON object types, the column name must end with
{}
.
Special data type: Attributes list
attribute0 | value0 | unlock0 | increase0 | max0 | attribute1 | value1[] | unlock1[] | increase1[] | max1[] | … | attributeN |
---|---|---|---|---|---|---|---|---|---|---|---|
ATT_HP | 30 | 2 | 1.2 | 8 | … | ||||||
ATT_AGI | 25 | 3 | 1.5 | 8 | … | ||||||
ATT_INT | 30 | 2 | 1 | 5 | ATT_CRIT | 3 | 2 | 0 | 11 | 0.5 | 1 | 10 | 20 | … | |
ATT_ATK | 30 | 2 | 1 | 8 | ATT_CRIT | 10 | 1 | 1 | 12 | 1.5 | 1 | 10 | 20 | … | |
ATT_CRIT | 10 | 1 | 1 | 12 | 1.5 | 1 | 10 | 20 | … |
Attribute is a specific data type, specially created for RPG genre games - where characters and equipment can possess various different and non-fixed attributes and stats. This data type makes character and equipment customization more flexible, without restrictions.
To define an attribute object type, the following rules should be followed:
- The attribute columns should be placed at the end of the data table.
- Attribute id is a constant integer, so it should be defined in the IDs sheet.
-
An attribute has the following structure:
attribute
: The column name follows the patternattribute + (index)
, where index can be any number, but should start from 0 and increase. The value of this column is the id of the attribute, which is an Integer type, this value should be set in the IDs sheet.value
: The column name follows the patternvalue + (index)
orvalue + (index) + []
, the value of the column can be a number or a number array.increase
: The column name follows the patternincrease + (index)
orincrease + (index) + []
. This is an additional value, which can be present or not, usually used for level-up situations, specifying the additional increase when a character or item levels up.unlock
: The column name follows the patternunlock + (index)
orunlock + (index) + []
. This is an additional value, which can be present or not, usually used for situations where the attribute needs conditions to be unlocked, such as minimum level or minimum rank.max
: The column name follows the patternmax + (index)
ormax + (index) + []
. This is an additional value, which can be present or not, usually used for situations where the attribute has a maximum value.
Example 1: attribute0, value0, increase0, value0, max0. Example 2: attribute1, value1[], increase1[], value1[], max1[].
7. How to integration
Download and import the Example
First, open the excel file located at /Assets/SheetX/Examples/Exporting a Single Excel/Example.xlsx
. This is a sample Excel file. Within this file, there are sheets containing sample data that will help you understand how to design various types of data such as IDs, Constants, and Data Tables.
For the example using Google Sheets, you can view the file here.
Example for exporting single file Example
Example for exporting multiple files Example 1 Example 2 Example 3 Example 4
7.1. Create folders for exporting files
Create 3 directories to store the files that will be exported:
- A folder to store the C# scripts (IDs and Constants).
- A folder to store the JSON data files.
- Navigate to
Window > SheetX > Settings
- In Sheets Exporter Settings, set up the paths for the “Scripts Output Folder” and “Json Output Folder,” using the two folders you just created.
For this example I will create 3 folders:
Assets\SheetXExample\Scripts\Generated
: for C# scriptsAssets\SheetXExample\DataConfig
: for Json data
7.2. Scripting
Create a ScriptableObject as Storage for Static Database
- Create Serializable classes that correspond to the data fields in the data tables.
[Serializable]
public class ExampleData1
{
public int numberExample1;
public int numberExample2;
public float numberExample3;
public bool boolExample;
public string stringExample;
}
[Serializable]
public class ExampleData2
{
[Serializable]
public class Example
{
public int id;
public string name;
}
public string[] array1;
public int[] array2;
public int[] array3;
public bool[] array4;
public int[] array5;
public string[] array6;
public Example json1;
}
[Serializable]
public class ExampleData3
{
public int id;
public string name;
public List<Attribute> Attributes;
}
[Serializable]
public class Attribute
{
//=== MAIN
public int id;
public float value;
public int unlock;
public float increase;
public float max;
//=== Optional
public float[] values;
public float[] increases;
public float[] unlocks;
public float[] maxes;
}
- Create a ScriptableObject to encapsulate the above Serializable classes.
[CreateAssetMenu(fileName = "ExampleDataCollection", menuName = "SheetXExample/Create ExampleDataCollection")]
public class ExampleDataCollection : ScriptableObject
{
public List<ExampleData1> exampleData1s;
public List<ExampleData2> exampleData2s;
public List<ExampleData3> exampleData3s;
}
- Load Json Data into Serializable classes
// NOTE: This function utilizes the UnityEditor library and must be placed in the Editor directory or within #if UNITY_EDITOR directives.
// If you prefer not to use Editor code, you can alternatively store the JSON data files in the Resources directory or Asset Bundles and load them accordingly.
[ContextMenu("Load")]
private void LoadData()
{
#if UNITY_EDITOR
var txt = AssetDatabase.LoadAssetAtPath<TextAsset>("Assets/Import/Json/ExampleData1.txt");
exampleData1s = JsonConvert.DeserializeObject<List<ExampleData1>>(txt.text);
txt = AssetDatabase.LoadAssetAtPath<TextAsset>("Assets/SheetXExample/DataConfig/ExampleData2.txt");
exampleData2s = JsonConvert.DeserializeObject<List<ExampleData2>>(txt.text);
txt = AssetDatabase.LoadAssetAtPath<TextAsset>("Assets/SheetXExample/DataConfig/ExampleData3.txt");
exampleData3s = JsonConvert.DeserializeObject<List<ExampleData3>>(txt.text);
#endif
}