# Using Accessories

### Add / Remove Accessories

To add or remove an item simply call methods on the characters accessoryBuilder.

* To Add an accessory
  * `character.accessoryBuilder.Add(prefabInProject);`
* To Remove an accessory
  * `character.accessoryBuilder.RemoveBySlot(AccessorySlot.Head);`
  * `character.accessoryBuilder.RemoveAll();`
  * `character.accessoryBuilder.RemoveClothingAccessories();`

### Working with Outfits

Often the character will be loading their select outfit which writes to the accessory builder. So if you want overwrite someones outfit you will need to wait for it to load, then modify it.&#x20;

{% hint style="info" %}
If you don't want characters to auto load their outfit, there is an option on the `Character` component of your character prefab.
{% endhint %}

Below is an example of waiting for the outfit to load and then adding your own accessories.

```typescript
import { Airship } from "@Easy/Core/Shared/Airship";

export default class LoadAccessoryList extends AirshipBehaviour {
	@Header("Accessory Prefabs")
	@Tooltip("Requires AccessoryComponent")
	public accPrefabs: GameObject[];

	private loadingOurAccessories = false;

	override Start(): void {
		// Listen for the local character
		Airship.Characters.ObserveCharacters((char) => {
			char.WaitForInit();
			if (char.IsLocalCharacter()) {
				// This is the local character
				// Mesh combined fires when new accessories are added to the character
				// So if your character auto loads its outfit this will fire
				char.accessoryBuilder.OnMeshCombined.Connect(() => {
					// Make sure this event isn't from our CombineMesh call
					if (this.loadingOurAccessories) {
						this.loadingOurAccessories = false;
						return;
					}
					this.loadingOurAccessories = true;
					
					// Add each accessory from our prefab list
					for (const acc of this.accPrefabs) {
						char.accessoryBuilder.Add(acc.GetComponent<AccessoryComponent>()!);
					}

					// Regenerate the character mesh with the new accessories
					char.accessoryBuilder.UpdateCombinedMesh();
				});
			}
		});
	}
}

```

To Test:

* Create a new Typescript file named "LoadAccessoryList" and past this code into it
* On a GameObject in your scene, click `add typescript component` and select LoadAccessoryList
* Drag any accessory prefabs from your project into the accPrefab variable on your scene GameObject

Now when your character spawns it will load those accessories.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.airship.gg/accessories/using-accessories.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
