# MML Attachments

{% hint style="success" %}
verified: 2025-12-08 version: v39
{% endhint %}

MML can be used to define static mesh attachments that are stored online, and can be socketed to player characters during gameplay. This is an alternative to creating attachment meshes directly as Unreal assets - they can be easier to use as replication is handled automatically, but they can't have custom colors or materials.

### MML Attachment format

The attachment MML files must be in a specific format, consisting of a single `<m-model>` node with a `socket` attribute. The simplest MML attachment will look like this:

```
<m-model socket="hand_r" src="https://my_url/model.glb"></m-model>
```

The socket must be the name of a bone or socket on the UE5 skeleton. When attached, the model's origin will be attached to the specified bone or socket.

You can also optionally specify an extra transform to apply, to translate/rotate/scale the model relative to the socket. This is the full set of attributes to define translation, rotation and scale:

```
<m-model socket="hand_r" src="https://my_url/model.glb"
  x="0.1" y="0.0" z="0.06"
  rx="90" ry="180" rz="0"
  sx="0.25" sy="0.25"sz="0.25">
</m-model>
```

### Adding and removing attachments

You use the `M2M_CharacterAssetComponent` on a player's Morpheus actor to add and remove MML attachments. Calling `Auth_AddMMLAttachment` will add the attachment and return a handle. Pass this handle into `RemoveAttachment` to remove it again (note that the same `RemoveAttachment` function is used for both MML and static mesh attachments).

These functions can only be called on the authoritative client. The attachment is automatically replicated to remote clients, so no manual replication is required (unlike with static mesh attachments).

<figure><img src="https://1456550285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoWTlPaoHd1McSakqMigu%2Fuploads%2F5Cw6NVutYlrMuZREWRVo%2Fimage.png?alt=media&#x26;token=91da3938-5402-4561-af4e-d34b96b956f7" alt=""><figcaption></figcaption></figure>

### Live config

Each player character can use and replicate a maximum of 12 Carnival meshes. Because MML attachments are rendered using Carnival, each added attachment comes out of this budget. By default attachments are lower priority that normal character meshes, so if a player's avatar has too many individual meshes then attachments won't render.

You can use the `Carnival.NumMeshesReservedForAttachments` live config to control this. Setting this will ensure at least this many attachments are visible, and limit normal character meshes to the remaining slots.
