Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Import / Export now available!

Discussion in 'Unity Remote Config' started by markychoi, Oct 29, 2019.

  1. markychoi

    markychoi

    Moderator

    Joined:
    Aug 4, 2014
    Posts:
    40
    We are adding the ability to import and export settings using comma-separated-value (CSV) format files.

    For existing Remote Settings users, you can use this new functionality to easily migrate your settings from Remote Settings to the new Remote Config. This forum post will detail how to migrate your settings, along with known limitations.

    Steps for Migrating Settings
    Step 1: Export your current settings from Remote Settings
    To export your current settings:
    1. Navigate to the Remote Settings page on your Unity Analytics Dashboard.
    2. Choose the configuration, either “Release” or “Development” that you want to export.
    3. Click the menu icon at the right side of the list header
    4. Choose "Download CSV" to export the current settings to your computer.
    The Analytics Service downloads your current settings as a CSV file.

    Note that if you download the CSV file before creating any settings in Remote Settings, the file is completely empty. A valid file for uploading to Unity Remote Config must contain the header row (see below “Remote Config CSV Format”).

    Step 2: Prepare your settings for import
    Currently, Remote Config only supports the following three fields in the CSV settings file: key,type,value (see below “Remote Config CSV Format”), whereas the Remote Settings CSV Format supports those same three fields plus two additional fields “segment” and “priority”. (Remote Config does support the implementation of logic to target specific user groups and deliver different settings for each group, see below “Remote Config Rules”).

    Required Steps
    Each row in the CSV file uploaded to Remote Config must contain a unique key. In the case where the exported file from Step 1 contains duplicate keys, you must remove them.

    Duplicate keys will appear in the CSV file when you have segment values (not including “All Current Users”) for settings in Remote Settings.

    If you try to upload a CSV file with duplicate keys, the Import/Export window in Remote Config will display an error, and no changes are made to your Remote Config settings.

    Optional Steps
    Remote Config will ignore any header fields other than the three (key,type,value) that are supported. We recommend that you remove extraneous fields (segment, priority) before importing your CSV file, though this is not required.

    In addition to migrating existing setting values from Remote Settings, you can create and delete settings when you upload a CSV file for configuration in Remote Config by editing this file to make your changes.

    To create a new setting:
    1. Add a new row in the file.
    2. Specify a unique key name.
    3. Define the data type (int, float, string, long, or bool).
    A new setting will look like: a_bool_value,bool,TRUE

    To delete a setting: simply delete the row defining the setting from the file.

    Step 3: Import your settings into Remote Config
    1. Sign-in into the Remote Config dashboard and select any project
    2. Navigate to the Configs Summary Page
    3. Choose the configuration, either "Release" or "Development" that you want to overwrite with the imported settings.
    4. Click the menu icon at the right side of the list header:
    5. Choose "Upload CSV" to import a new settings file to the project.
    6. Choose the CSV file containing the new settings.
    7. Click "Open".
    The Remote Config Service uploads the settings file and replaces all the current settings in the selected configuration, but does not commit the values yet.

    If a format or value error exists in the file, the service gives you an option to download a CSV file detailing the errors. No changes are made to the settings when an error occurs.

    8. Click "Sync" to commit the setting changes and make them live. (Refresh the page or navigate away without synchronizing to discard any uploaded settings.)​

    When you import settings, **ALL** the keys and values are changed to match the uploaded file. If an existing setting does not appear in the file, that setting is deleted.

    Remote Config CSV Format
    The Remote Config CSV format conforms to [ISO rfc4180](https://tools.ietf.org/html/rfc4180). The exported file is encoded as UTF-8.

    The settings file has three fields. You must include the header row as the first line in the file: key,type,value

    The fields in the file are:

    * __key__ -- The name of a Remote Config key.
    * __type__ -- the setting data type: int, float, string, or bool.
    * __value__ -- the setting value.

    **Rules for entries in the CSV file:**
    • Each row must contain a unique key.
    • Use TRUE and FALSE for Boolean values.
    • Strings containing commas, double quotes, and line breaks must be enclosed with double-quote characters.
    • Double quote characters in a string must be escaped by repeating the double quote. For example:
    "Hello World!" -> """Hello World!"""
    He said, "How do you do?" -> "He said, ""How do you do?"""​

    Remote Config Rules
    Unity Remote Config uses Rules to target specific user groups and deliver different settings for each group. Rules are linked to Settings, which you’ll map to variables in your game code to override their default values when the audience criteria for a Rule is met.

    For more information, refer to “Rules and Settings” in the Remote Config Package Documentation and “Rules” in the Remote Config API Documentation.

    Working with Spreadsheets
    The CSV file format is not rigorously standardized, so you may experience variations when opening or saving CSV files in different spreadsheet applications. Always test that the fields in your Remote Settings file are properly preserved after making the round trip from the Remote Settings page, to your editing application, and back. Especially check that Unicode characters (Emoji, symbols, characters outside the basic ASCII range, etc) are not altered and that floating point numbers are not truncated.

    Usually when importing a CSV file, spreadsheet applications interpret strings starting with `'`, `+`, `-`, or `=` characters as expressions rather than plain strings. You can try enclosing such strings in double quotes and adjusting the import options of the spreadsheet you are using. For example, in Google Sheets you can turn off the "Convert strings to numbers and dates" option; while in LibreOffice you can turn on, "Quoted Strings As Text".

    For settings of type float, make sure that all significant digits of the setting value are displayed in the spreadsheet cell. Otherwise, the value might be truncated and lose precision when you export the spreadsheet to CSV.