---
description: >-
  This function is ideally utilized for PFP projects that were created by
  Generative Art.
---

# 2. Trait Mapping

**MYTY Kit supports expressing multiple PFP Avatars from one AssetBundle file.** It means that multiple PFP Avatars will share skeletons and animations defined. And this function can be supported through Trait Mapping file. Trait Mapping file has information about which image layers need to be included in each NFT.

## Avatar Trait Mapping in MYTY Kit

### What is Avatar Trait?

* Every single NFT has its own traits, which represent the key characteristics of the PFP image of the NFT.
* Based on the traits, we can imagine what the image of the NFT will look like.
* As most of the PFP collections have been created by generative art algorithms, each NFT shares its traits with other NFTs in the collection.

![Traits of Doodle #7973 displayed in Opensea](https://1381431913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6CBs7vCLqptAiFUTrCYl%2Fuploads%2FqW2zIsLtLa2rww1ctF1H%2Ftraits.png?alt=media\&token=3b0e7bc4-4e31-4434-bc2a-bf0c2ebae0a7)

### What is Trait Mapping?

![Using the Trait Mapping file, MYTY Kit piles the selected image layers up and shows the appearance of each PFP Avatar](https://1381431913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6CBs7vCLqptAiFUTrCYl%2Fuploads%2FmgJOIFt2BgScBbefRp5d%2Ftrait%20mapper.png?alt=media\&token=1ab1828f-fe02-43cf-839c-66d30c2fb908)



* The Trait Mapping file has information about which image layers need to be included in each NFT.
* MYTY Kit utilizes the Trait Mapping file to pile the selected image layers up and build the full image of each PFP avatar.
* The method [5.-import-2d-avatar-assets](5.-import-2d-avatar-assets "mention") loads the Trait Mapping file and the file is used to create [Avatar Selector](../before-you-begin/myty-kit-glossary).
* Avatar Selector enables us to display certain Avatar that we want to load, by updating the parameter **Avatar ID** included in Avatar Selector.

### Why do we need a Trait Mapping file?

* Basically, of course it is possible to create a PFP avatar that supports a single NFT.
* In this case, if we want to create PFP Avatars for the collection level, we have to do the work 10k times repeatedly.
* Using the Trait Mapping file, we only need to create skeletons just once (or several times at most), and each PFP Avatar will share the same skeletons.
* The size of the Motion Adaption-related work and Controller-related work are also significantly reduced, if we use the Trait Mapping file.
* In this case, the PSB file should consist of all the image layers of the whole collection.

## How to create a Trait Mapping file?

* You can either:

1.  Use MYTY's MYTY Kit Trait Mapper Web.

    [guide-to-myty-kit-trait-mapper](2.-trait-mapping/guide-to-myty-kit-trait-mapper "mention")\
    \
    Or,\

2. Manually create a Trait Mapping file

### What is the specification of Trait Mapping file?

* File Extension: **JSON** file
* Sample file

{% file src="https://1381431913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6CBs7vCLqptAiFUTrCYl%2Fuploads%2FMqOti0dz6Y59B1TNhMTY%2FghostTraits.json.zip?alt=media&token=68e88202-0f3e-4fa2-b9c2-65c96681d481" %}
Trait Mapping file of Ghostsproject collection
{% endfile %}

* File Format

```
[
	{
		"id": int,  // token ID
		"filename": string,  // file name of psd file
		"traits": List<string>  // array of full paths of image layers
	},
	...
]
```

* Example JSON file

```
[
	{
		"id": 0,
		"filename": "CollectionName_A_v01.psb",
		"traits": [
			"Body/BlueAndYellowJacket",
			"Head/Tan",
			"Face/Eyes/BlackLeftEye",
			 ...
			"Hair/PurpleLong"
		]
	},
	{
		"id": 1,
		"filename": "CollectionName_A_v01.psb",
		"traits": [
			"Body/PurpleSweaterWithSatchel",
			"Head/Gradient2",
			"Face/Eyes/BlackLeftEye",
			 ...
			"Hair/WhiteBucketCap"
		]
	},
	...
	{
		"id": 9999,
		"filename": "CollectionName_B_v01.psb",
		"traits": [
			"Body/PinkFleece",
			"Head/Yellow",
			"Face/Eyes/BlackLeftEye",
			 ...
			"Hair/BlueMessy"
		]
	}
]
```

## Is it possible to update the Trait Mapping file?

#### 👉 After you imported the Trait Mapping file to the Unity Project:

* It is never recommended to update the Trait Mapping file. We recommend building another project using the new Trait Mapping file. However, if it is inevitable, please contact [MYTY Kit Community](https://discord.com/invite/myty).

#### 👉 After you exported Asset Bundle of the collection:

* You have to update the Unity Project first. Please contact [MYTY Kit Community](https://discord.com/invite/myty). After the update, you need to export Asset Bundle again.



{% hint style="success" %}
**Have a question or an idea?** \
If you have a question to ask or an idea to share, participate in the [MYTY Kit Community](https://discord.com/invite/myty). We’d love to hear from you.:smile:
{% endhint %}
