Generate Unreal Engine C++ Source Code
Generates C++ for Unreal Engine source code for game data into output directory.
By default, this command does not delete previously generated files. Use the --clearOutputDirectory parameter to automatically remove prior generated files before creating new ones.
Command
# local game data (windows)
charon GENERATE UECPPCODE --dataBase "c:\My Project\Content\gamedata.json" --outputDirectory "c:\My Project\Source\Gamedata"
# remote game data
charon GENERATE UECPPCODE --dataBase "https://charon.live/view/data/My_Game/develop/" --outputDirectory "./My Project/Source/Gamedata" --credentials "<API-Key>"
Parameters
- --dataBase
Absolute or relative path to game data. Use quotation marks if your path contains spaces.
# local file --dataBase "c:\My Project\Content\gamedata.json" # remote server --dataBase "https://charon.live/view/data/My_Game/develop/"
- --credentials
The API key used to access remote server in case of –dataBase being URL.
- --outputDirectory
Specifies the path where the source code should be written. It can be either an absolute or relative path to a directory. The specified directory must already be present.
# Windows --outputDirectory "c:\My Project\Source\Gamedata" # Linux or OSX --outputDirectory "~/My Project/Source/Gamedata" # Relative path --outputDirectory "./My Project/Source/Gamedata"
- --documentClassName
Name for base class for all documents.
# name (default) --documentClassName Document # became UDocument in generated code # in case of custom inheritance chain # class SHOULD publicly inherit UDocument --documentClassName GameDataDocument # became UGameDataDocument in generated code
- --gameDataClassName
Name for class containing whole in-memory game data.
# name (default) --gameDataClassName GameData # became UGameData in generated code # in case of name collision --gameDataClassName MyGameData # became UMyGameData in generated code
- --defineConstants
Preprocessor constants to define. Use semicolon(;) to separate multiple values.
--defineConstants NO_OPTIMIZATIONS;USE_FSTRING_ONLY
- --indentation
Indentation style for generated code.
# Tabs (default) --indentation Tabs # Two spaces --indentation TwoSpaces # Four spaces --indentation FourSpaces
- --lineEndings
Line ending symbols for generated code.
# Windows \\r\\n (default) --lineEndings Windows # Unix style \\n --lineEndings Unix
- --optimizations
List of enabled optimization in generated code.
# Eagerly resolves and validates all references in loaded documents. # When enabled, this optimization ensures that all references in documents are resolved and validated # during loading. This comes with a performance cost but guarantees the validity of references. --optimizations eagerReferenceResolution # Opts for raw references without generating helper methods for referenced documents. # With this optimization, the generated code will not include helper methods for accessing # referenced documents, keeping only accessors that work with raw references. --optimizations rawReferences # Avoids generating helper methods for localized strings, keeping only raw accessors. # This optimization eliminates helper methods for accessing localized text, instead providing # accessors that deal directly with lists of localized texts. --optimizations rawLocalizedStrings # Disables string pooling during game data loading. # Turning off string pooling can yield a minor performance improvement at the cost of increased # memory usage, as it avoids reusing short strings. --optimizations disableStringPooling # Disables generation of code for loading game data from JSON formatted files. # This optimization omits code related to JSON serialization, useful when JSON formatted # game data is not used. --optimizations disableJsonSerialization # Disables generation of code for loading game data from Message Pack formatted files. # Similar to DisableJsonSerialization, this option removes code related to loading data # from Message Pack formatted files. --optimizations disableMessagePackSerialization # Disables generation of code related to applying patches during game data loading. # This removes a significant portion of code that is mainly used for modding support, # where patches are applied to game data at runtime. --optimizations disablePatching # Disables generation of enums with known document IDs. # This removes a significant portion of code that contains listings of IDs for # documents known at the moment of code generation, which improves compilation time. --optimizations disableDocumentIdEnums
- --clearOutputDirectory
Clear the output directory from generated files. Generated files are identified by the presence of the ‘<auto-generated>’ tag inside.
This command supports universal parameters.
See also
Generating Source Code
Publication