Basic Importing
Assets should be able to imported through normal Unreal Engine means. Either by dropping the .tmx/.tsx files into the Content Browser, or using the Content Browser's import buttons directly.
Sometimes when importing an asset it may be necessary to import one or more other assets as well. For example, Tile Maps reference Tile Sets, and Tile Sets reference textures. Tiled Link aims to make this process as smooth as possible. When a reference to another asset needs to be obtained, TiledLink will first search for any existing asset that was created from that file before. If no such asset exists, TiledLink will automatically begin importing a new asset for that file and prompt you to allow you to change it's destination (default to source file location).
Tiled Link introduces new subclasses of the basic Paper2D Tile Map, Layer, and Tile Set classes. This is necessary to track asset import data (for tile sets) as well as certain tiled specific data such as layer ids for tile map layers. By default assets will be imported as these types. We'll touch more on these in Chapter 3 but if you don't have specialized needs you shouldn't need to change this.
Configuration
Project File - The project file is used for the importer's custom property reflection support and is needed to determine the default values for any custom types encountered while parsing properties.
Tile Maps
Tile Map Class - The class to use for creating the new Tile Map asset. Allows for compatibility with a custom TileMap class with specialized behavior, or for declaring custom properties that you'd like to be able to set and import from Tiled. Tile Layer Class - Tile Map layers are implemented as subobjects. This class controls what class to instantiate them with. Same usages as the Tile Map Class.
Tile Sets
Tile Set Class - The class to use for creating the new Tile Set asset. Same usages as the Tile Map Class and Tile Layer Class configuration options.
See the section on Asset Type Overrides for more detail on the Class options.
Custom Properties
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;
};
Future Extensions
If there's any issues you've noticed or features you feel are missing please let me know! In the meantime, here are some of the things currently on my radar for improving the tool.
Convert existing assets to new types
Goal would be to recreate the asset without breaking existing references. This would ease the transition process for existing projects or projects being refactored to use a new class for their assets.
Choose class to create assets with based on the class field set on them from Tiled
For complex projects that require multiple subclasses of tilemaps or tilesets, providing the option of choosing the asset's class directly from Tiled could be far more convenient than having to manually ensure the correct class is selected on every import.