Custom Properties

Custom Properties In Tiled Custom Properties Importd

Tiled Link fully supports Tiled's custom property system and will automatically import any properties that match a UPROPERTY also defined on type of the imported asset.

If you are using Custom Types within tiled, those type definitions will be serialized in the .tiled-project file. Setting the path to this file when importing a tile map or tileset is necessary to properly discover any default values, as Tiled doesn't serialize values for properties that are the same as their default.

If you want to import properties for a struct or UObject, you will need to define a corresponding Tiled Class in the tiled project's Custom Types. It is necessary that the class name in Tiled matches the class name in Unreal, minus the U prefix. When importing, TiledLink will create subobjects for any class properties that are encountered. Class properties support both C++ UCLASSes as well as Blueprint classes.

UENUMs are also supported. For importing Enum properties, you can either make a string custom property with the value corresponding to the name of the desired variant, or you can redefine the enum as a Tiled Custom Type to get the Tiled Editor to give you a list of valid options when setting the value of the property.

NOTE: If you are editing a string property that has a corresponding tiled property while you reimport the same asset, Unreal Editor will overwrite the imported value for that string with whatever is currently in the text box.

The definition for the Tile Map class and the inner properties for the above example is as follows:

UENUM()
enum class EMyEnum
{
	Variant1,
	Variant2,
};

UCLASS()
class UCustomInnerClass : public UObject
{
	GENERATED_BODY()
public:
	UPROPERTY(EditAnywhere)
	FString InnerClassMember;
};

UCLASS()
class UCustomClass : public UObject
{
	GENERATED_BODY()
public:
	UPROPERTY(EditAnywhere, Instanced)
	TObjectPtr<UCustomInnerClass> InnerClassObject;
};

/**
 * An example class of how to override the TileMap type used by the importer.
 */
UCLASS()
class TILEDLINKEXAMPLE_API UTileMapOverrideExample : public UTiledLinkTileMap
{
	GENERATED_BODY()

public:
	UPROPERTY(EditAnywhere)
	EMyEnum EnumExample;

	UPROPERTY(EditAnywhere)
	FVector VectorProperty;

	UPROPERTY(EditAnywhere, Instanced)
	TObjectPtr<UCustomClass> CustomClassObject;

	UPROPERTY(EditAnywhere, Instanced)
	TObjectPtr<UObject> CustomBlueprintObject;
};