⮞ Go to NeoFPS.com

    Show / Hide Table of Contents

    ConstantsSettings ScriptableObject

    Overview

    The ConstantsSettings asset is used to generate and maintain arbitrary constants for a game. The generated output script contains a wrapped constant that acts in code like an enum, but can intrisically convert to its base type. A drawer is also generated that shows a dropdown with the constant values when the generated constant is serialized in the inspector. These constants have a number of uses such as object IDs or keys, without the overhead of using strings and dictionaries.

    See Generated Constants for more information.

    Inspector

    ConstantsSettings

    Properties

    Output

    Name Type Description
    TargetDirectory Folder Where the generated constant script should be output.
    EditorDirectory Folder Where the generated constant editor script should be output.

    Source Templates

    Name Type Description
    ByteConstant TextFile The text file to use when generating byte constants.*
    ByteDrawer TextFile The text file to use when generating a byte constant editor script.*
    IntConstant TextFile The text file to use when generating integer constants.*
    IntDrawer TextFile The text file to use when generating an integer constant editor script.*
    UIntConstant TextFile The text file to use when generating unsigned integer constants.*
    UIntDrawer TextFile The text file to use when generating an unsigned integer constant editor script.*
    ShortConstant TextFile The text file to use when generating short constants.*
    ShortDrawer TextFile The text file to use when generating a short constant editor script.*
    UShortConstant TextFile The text file to use when generating unsigned short constants.*
    UShortDrawer TextFile The text file to use when generating an unsigned short constant editor script.*
    * For more information on how the template is turned into a script see Generated Constants.

    Controls

    The Generate All button will output a script file and a drawer script file to the specified directories for each constant, overwriting any existing files with the same name.

    The Add Constant button will add a new constant settings entry to this scriptable object

    Constant settings

    Each constant has a number of common controls:

    The Generate button will output a script file and a drawer script file to the specified directories, overwriting any existing files with the same name.

    The Remove button will remove this constant from the scriptable object. Any existing generated files will not be touched.

    Each constant also has the following properties:

    Name Type Description
    Class Name String The name for the output constant. This will also be the output script file name, while the output drawer script will be named Drawer.
    Class Namespace String The namespace for the output scripts.
    Base Type Dropdown This value specifies which source templates should be used to generate the constant.
    Constant Values String Array A sequential array of constant value names. These must be valid names, and not duplicated. Use the + and - buttons to add or remove values, or reorder by dragging the handle on the left of the array entry.

    See Also

    Back to top Copyright © 2019 Yondernauts Game Studios Ltd
    Generated with DocFX