Class LDtkFields
This is a component that stores the field instances for entities/levels, Conveniently converted for use in Unity.
Methods
| Improve this Doc View SourceContainsField(String)
Used to check if a field exists in this component.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
GetArraySize(String)
Used to get the size of an array field.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.Int32 | The array's length. If the field is not found or is not an array, the value is 0. |
GetBool(String)
Gets a bool field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.Boolean | The field's value. If the field doesn't exist, then returns a default value type. |
GetBoolArray(String)
Gets a bool field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.Boolean[] | The field's value. If the field doesn't exist, then returns a default value type. |
GetColor(String)
Gets a color field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
UnityEngine.Color | The field's value. If the field doesn't exist, then returns a default value type. |
GetColorArray(String)
Gets a color field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
UnityEngine.Color[] | The field's value. If the field doesn't exist, then returns a default value type. |
GetDefinition(String)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier |
Returns
Type | Description |
---|---|
LDtkDefinitionObjectField |
GetEntityReference(String)
Gets an entity reference field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
LDtkReferenceToAnEntityInstance | The field's value. If the field doesn't exist, then returns a default value type. |
GetEntityReferenceArray(String)
Gets an entity reference field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
LDtkReferenceToAnEntityInstance[] | The field's value. If the field doesn't exist, then returns a default value type. |
GetEnum<TEnum>(String)
Gets a enum field's value. It's encouraged to use the auto-generated scripts with this, but you can also use your own scripts as long as the enum value names match.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
TEnum | The field's value. If the field doesn't exist, then returns a default value type. |
Type Parameters
Name | Description |
---|---|
TEnum | The enum type to get. |
GetEnumArray<TEnum>(String)
Gets a enum field's values. It's encouraged to use the auto-generated scripts with this, but you can also use your own scripts as long as the enum value names match.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
TEnum[] | The field's value. If the field doesn't exist, then returns a default value type. |
Type Parameters
Name | Description |
---|---|
TEnum | The enum type to get. |
GetFilePath(String)
Gets a file path field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.String | The field's value. If the field doesn't exist, then returns a default value type. |
GetFilePathArray(String)
Gets a file path field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.String[] | The field's value. If the field doesn't exist, then returns a default value type. |
GetFloat(String)
Gets a float field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.Single | The field's value. If the field doesn't exist, then returns a default value type. |
GetFloatArray(String)
Gets a float field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.Single[] | The field's value. If the field doesn't exist, then returns a default value type. |
GetInt(String)
Gets an int field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.Int32 | The field's value. If the field doesn't exist, then returns a default value type. |
GetIntArray(String)
Gets an int field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.Int32[] | The field's value. If the field doesn't exist, then returns a default value type. |
GetMultiline(String)
Gets a multiline field's value. IMPORTANT: Make sure that the LDtk project is configured to use "Multilines" in it's advanced settings
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.String | The field's value. If the field doesn't exist, then returns a default value type. |
GetMultilineArray(String)
Gets a multiline field's values. IMPORTANT: Make sure that the LDtk project is configured to use "Multilines" in it's advanced settings
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.String[] | The field's value. If the field doesn't exist, then returns a default value type. |
GetPoint(String)
Gets a point field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
UnityEngine.Vector2 | The field's value. If the field doesn't exist, then returns a default value type. |
GetPointArray(String)
Gets a point field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
UnityEngine.Vector2[] | The field's value. If the field doesn't exist, then returns a default value type. |
GetString(String)
Gets a string field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.String | The field's value. If the field doesn't exist, then returns a default value type. |
GetStringArray(String)
Gets a string field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.String[] | The field's value. If the field doesn't exist, then returns a default value type. |
GetTile(String)
Gets a tile field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
UnityEngine.Sprite | The field's value. If the field doesn't exist, then returns a default value type. |
GetTileArray(String)
Gets a tile reference field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
UnityEngine.Sprite[] | The field's value. If the field doesn't exist, then returns a default value type. |
GetValueAsString(String)
Returns a field's value as a string. This is type-agnostic.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.String | The field's value as a string. |
GetValuesAsStrings(String)
Returns a field's values as strings. This is type-agnostic.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.String[] | The field's values as strings. |
IsArray(String)
Used to check if a field is an array.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.Boolean | If the field is an array. If the field is not found, returns false. |
IsNull(String)
Used to check if a single field is null in this component.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
Returns
Type | Description |
---|---|
System.Boolean | If the field doesn't exist or is null. |
IsNullAtArrayIndex(String, Int32)
Used to check if a field's array element is null in this component.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
System.Int32 | index | Index of the array. |
Returns
Type | Description |
---|---|
System.Boolean | If the field doesn't exist, is null, or if the index is outside the array's bounds. |
TryGetBool(String, out Boolean)
Gets a bool field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
System.Boolean | value | The field's value. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetBoolArray(String, out Boolean[])
Gets a bool field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
System.Boolean[] | values | The field's values. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetColor(String, out Color)
Gets a color field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
UnityEngine.Color | value | The field's value. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetColorArray(String, out Color[])
Gets a color field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
UnityEngine.Color[] | values | The field's values. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetEntityReference(String, out LDtkReferenceToAnEntityInstance)
Gets an entity reference field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
LDtkReferenceToAnEntityInstance | value | The field's value. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetEntityReferenceArray(String, out LDtkReferenceToAnEntityInstance[])
Gets an enum field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
LDtkReferenceToAnEntityInstance[] | values | The field's values. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetEnum<TEnum>(String, out TEnum)
Gets an enum field's value. It's encouraged to use the auto-generated scripts with this, but you can also use your own scripts as long as the enum value names match.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
TEnum | value | The field's value. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
Type Parameters
Name | Description |
---|---|
TEnum | The enum type to get. |
TryGetEnumArray<TEnum>(String, out TEnum[])
Gets an enum field's values. It's encouraged to use the auto-generated scripts with this, but you can also use your own scripts as long as the enum value names match.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
TEnum[] | values | The field's values. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
Type Parameters
Name | Description |
---|---|
TEnum |
TryGetFilePath(String, out String)
Gets a file path field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
System.String | value | The field's value. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetFilePathArray(String, out String[])
Gets a file path field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
System.String[] | values | The field's values. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetFloat(String, out Single)
Gets a float field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
System.Single | value | The field's value. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetFloatArray(String, out Single[])
Gets a float field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
System.Single[] | values | The field's values. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetInt(String, out Int32)
Gets an int field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
System.Int32 | value | The field's value. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetIntArray(String, out Int32[])
Gets an int field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
System.Int32[] | values | The field's values. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetMultiline(String, out String)
Gets a multiline field's value. IMPORTANT: Make sure that the LDtk project is configured to use "Multilines" in it's advanced settings
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
System.String | value | The field's value. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetMultilineArray(String, out String[])
Gets a multiline field's values. IMPORTANT: Make sure that the LDtk project is configured to use "Multilines" in it's advanced settings
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
System.String[] | values | The field's values. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetPoint(String, out Vector2)
Gets a point field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
UnityEngine.Vector2 | value | The field's value. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetPointArray(String, out Vector2[])
Gets a point field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
UnityEngine.Vector2[] | values | The field's values. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetString(String, out String)
Gets a string field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
System.String | value | The field's value. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetStringArray(String, out String[])
Gets a string field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
System.String[] | values | The field's values. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetTile(String, out Sprite)
Gets a tile field's value.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
UnityEngine.Sprite | value | The field's value. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetTileArray(String, out Sprite[])
Gets a tile field's values.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
UnityEngine.Sprite[] | values | The field's values. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetValueAsString(String, out String)
Returns a field's value as a string. This is type-agnostic.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
System.String | value | The field's value as a string. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |
TryGetValuesAsStrings(String, out String[])
Returns a field's values as strings. This is type-agnostic.
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The field instance's identifier. Case sensitive. |
System.String[] | value | The field's values as strings. |
Returns
Type | Description |
---|---|
System.Boolean | If the field exists. |