Page tree

This page has not yet been translated to English.

Skip to end of metadata
Go to start of metadata

Game data editor can generate API for accessing game data. Currently only C# is supported.

Option 1: Unity editor extension

  1. Launch Unity editor
  2. Open Project window by using WindowProject menu
  3. Select your game data file in Project window.
  4. Open Inspector window by using WindowInspector menu
  5. In Inspector window: select Code Generator → C Sharp
  6. Set up your code generation parameters.

Source code generation parameters

Name

Type

Description

Auto-Generation

yes/no

Automatic code generation when data file is changed.

Generation Path

path

Path to the file which the code will be saved to. If the file exists, it will be overwritten. The folders must already exist.

Example: Assets/Scripts/GameParams/gamedata.cs

API Class

string

The name of the class providing access to the documents.

Default: GameData

Example: CityOfWondersData

Document Class

string

Name of the base class for all entities.

Default: Document

Example: Record

Namespace

string

Namespace to contain new generated types.

Example: Assets.Scripts.GameParams

Line Endings

Windows
Unix

Type of EOL characters in the generated file. Windows uses \r\n, while Unix uses \n.

Default: Windows

Indentation

Tab
TwoSpaces
FourSpaces

Type of line indentation in the generated file.

Default: Tab

Options

Flags

Various flags affecting code generation (see below).

Source code generation flags

Flag

Description

Lazy References

Document references will be used when they are first addressed instead of when initially loading game data.

This may slightly increase loading speed.

Hide References

Replace document reference properties with properties accessing the actual document.

Example:

Reference<Character> Actor  { get; } → Character Actor { get; }

Hide Localized Strings

Replace localized string properties with properties containing string from selected localization.

Example:

LocalizedString Name { get; } → string Name { get; }

Suppress Document Class

Document class will not be generated.

Suppress Api Class

API class will not be generated.

Suppress Collection Class

ReadOnlyList<T>, ReadOnlyDictionary<Key, Value> classes will not be generated.

Suppress Localized String Class

LocalizedString class will not be generated.

Suppress Reference Class

Reference<T> class will not be generated.

Suppress DataContract Attributes

DataContract and DataMember attributes will not be added to generated classes.

Disable Expressions

Expression classes will not be generated and Formula fields will not be parsed.

Disable Json Serialization

JSON format deserialization classes will not be generated.

Disable BSON Serialization

BSON format deserialization classes will not be generated.

Disable MessagePack Serialization

Message Pack format deserialization classes will not be generated.

Disable XML Serialization

XML format deserialization classes will not be generated.

Option 2: Standalone application

  1. Launch game data editor with GENERATE CSHARPCODE and other parameters you want to use.
  2. API source code file should be generated. If this doesn't happen, check logs.

Related pages