Show / Hide Table of Contents

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 Source

ContainsField(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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

GetDefinition(String)

Parameters
Type Name Description
System.String identifier
Returns
Type Description
LDtkDefinitionObjectField
| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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
| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX