docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class KeyIdColumns

    Represents 3 possible columns in CSV data:

    1. Key. The unique name of the entry. This value is always included when exporting.
    2. Id. The Id value for the entry. This field is optional however strongly recomended if you expect to change the Key names.
    3. Shared Comments. Comment taken from SharedTableData for each entry. This field is optional.
    When importing from CSV all columns are treated as optional however there must be at least 1 Key or Id field. When adding new values to be imported from the CSV the Id field can be left blank or given the value 0, a new Id will be assigned during import.
    Inheritance
    object
    CsvColumns
    KeyIdColumns
    Implements
    IKeyColumn
    Inherited Members
    CsvColumns.WriteEnd(StringTableCollection)
    Namespace: UnityEditor.Localization.Plugins.CSV.Columns
    Assembly: Unity.Localization.Editor.dll
    Syntax
    [Serializable]
    public class KeyIdColumns : CsvColumns, IKeyColumn

    Properties

    Name Description
    IdFieldName

    The name of the Id field when exporting and importing. When importing this name will be checked against the headers to determine if an Id column is present in the CSV data.

    IncludeId

    Should the Id field be included as a field when exporting? When importing IdFieldName will be used to determine if the field is present.

    IncludeSharedComments

    Should the shared Comment be included as a field when exporting? When importing SharedCommentFieldName will be used to determine if the field is present.

    KeyFieldName

    The name of the Key field when exporting and importing. When importing this name will be checked against the headers to determine if a Key column is present in the CSV data.

    SharedCommentFieldName

    The name of the Shared Comments field when importing and exporting. When importing this name will be checked against the headers to determine if a Shared Comment column is present in the CSV data.

    Methods

    Name Description
    ReadBegin(StringTableCollection, CsvReader)

    Called when reading a CSV file column header row. This call should be used to determine which column indexes to use during ReadRow(SharedTableEntry, CsvReader). Use reader.GetFieldIndex("Column Header", isTryGet: true) to check for a column with a matching name.

    ReadEnd(StringTableCollection)

    Called when the CSV file has been imported. This can be used to perform any required cleanup.

    ReadKey(CsvReader)

    Returns the entry that should be mapped for the current row or null if one can not be found.

    ReadRow(SharedTableEntry, CsvReader)

    Called when reading each row of the CSV file. Unity recommends to store the indexes of the rows you are interested in during ReadBegin(StringTableCollection, CsvReader) and then use them to access the row using reader.GetField.

    WriteBegin(StringTableCollection, CsvWriter)

    Called when writing the header row of the CSV file. Each column that will be written to during WriteRow(SharedTableEntry, IList<StringTableEntry>, CsvWriter) should have its column header written here using writer.WriteField("Header Title").

    WriteRow(SharedTableEntry, IList<StringTableEntry>, CsvWriter)

    Called when writing each row of the CSV file. This is called in the same order as WriteBegin(StringTableCollection, CsvWriter) and expects each column that was written to be populated each time. If a column will not always contain a value, you can use writer.WriteField(string.Empty).

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)