> For the complete documentation index, see [llms.txt](https://bkortbus.gitbook.io/unreal-python-recipe-book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bkortbus.gitbook.io/unreal-python-recipe-book/metadata/setting-metadata.md).

# Setting Metadata

How to set metadata on an Unreal Asset

## Setting Metadata

Assets in the Content Browser can have metadata added to them using Python, to do this we just need a loaded reference to the asset (<mark style="color:green;">unreal.load\_asset()</mark>). With a loaded asset reference we can use the [EditorAssetLibrary ](https://dev.epicgames.com/documentation/en-us/unreal-engine/python-api/class/EditorAssetLibrary?application_version=5.3#unreal.EditorAssetLibrary.set_metadata_tag)to apply our metadata:

```python
asset_path = "/Game/some/asset/path"
asset = unreal.load_asset(asset_path)

unreal.EditorAssetLibrary.set_metadata_tag(asset, "key", "value")
```

{% hint style="info" %} <mark style="color:yellow;">Note</mark>: Metadata is stored as strings, make sure any numbers or other data types are converted to a string for this function
{% endhint %}

Because of how regularly I make use of metadata in my Unreal tools, even though it's small I do use a convenience function for this command to convert the value's type to a string for me:

```python
def set_metadata(asset, key, value):
    """set the asset's metadata value"""
    unreal.EditorAssetLibrary.set_metadata_tag(asset, key, str(value))
```
