You can use the Cosmetic API to define what a character wears, and change it at runtime using Verse.
It is built on four concepts:
Concept | Type | Description |
What |
| One wearable item. Each cosmetic is a class. On Fortnite characters, outfits are fort_outfit_cosmetic classes. |
Where |
| The slot an item goes in, such as |
Appearance |
| The entity prefab that presents the item: its mesh, name, descriptions and icon. |
Who or what wears it |
| Lives on the character entity and holds one cosmetic per category. |
A cosmetic has one prefab per style. Every cosmetic should provide a prefab for DefaultCosmeticStyle. That prefab is the cosmetic's display data, the entity the loadout spawns on the character, and the fallback for any style the cosmetic doesn't provide.
Cosmetics are referred to by class, not by instance. You declare a cosmetic as a concrete subclass and pass the class itself to the loadout. Its data is read from the class default. This is the same way Styles refers to prefabs.
The Fortnite Cosmetic API contains the following core components:
Cosmetic Prefab
Cosmetic Loadout Component
Fort Cosmetic Loadout Component
Outfit Prefabs
Outfit Templates
For more information about the Cosmetic Loadout components, see Cosmetic Loadout Components.
This document will take you through the process of making an outfit. The steps are as follows:
Make the prefab from a body type template.
Declare the outfit and set its prefab.
Put it on a character.
Making an Outfit
Before this step, you must have an existing character mesh, ideally in an A-pose. This document builds on the work completed in Create a Custom Outfit with Canvas.
An outfit requires two pieces: a prefab made in the editor from a body type template that holds the mesh and display data, and a Verse subclass of fort_outfit_cosmetic, which is the outfit itself.
Body type templates come in the following types:
Template | Body Type |
| Masculine, medium sized |
| Feminine, medium sized |
| Masculine, large sized |
| Feminine, large sized |
The template sets the body type, and your prefab inherits it. You don't set the body type anywhere else.
Follow these steps to create an outfit:
Right-click in the content browser and choose your desired outfit template. Charles uses the
masculine_medium_outfit_template.Replace the mesh. The template comes with a placeholder cube
mesh_component. Remove it, then add a newmesh_componentwith your mesh.Fill in the
description_component(name, description and short description) and the icon_component (icon). These are what the outfit'sGetName,GetDescription,GetShortDescriptionandGetIconreturn.Save it. The prefab appears in your project's Verse digest as a class. ******
An entity can only have one component of each type, so the placeholder has to be removed before you add yours.
Base your prefab on one of the templates, not on fort_outfit_cosmetic_prefab or cosmetic_prefab directly.
Making a Prefab from a Body Type Template
Outfit Declaration
Subclass fort_outfit_cosmetic and override Styles, which maps each cosmetic_style to a prefab class. Map DefaultCosmeticStyle to your prefab:
# MyOutfit.verse
using { /Fortnite.com/Characters }
using { /UnrealEngine.com/Characters/Cosmetics }
# An outfit whose mesh, body type and display data come from my_outfit_prefab.
my_outfit<public> := class<concrete>(fort_outfit_cosmetic):
Styles<override>:[cosmetic_style]castable_concrete_subtype(cosmetic_prefab) = map{DefaultCosmeticStyle => Prefab_Charles}
Important facts about the Styles object:
The values are prefab classes, not instances. Write the prefab's class name, not
my_outfit_prefab{}.The
DefaultCosmeticStyleentry is the one that is read. It provides the display data, the body type, and the prefab the loadout spawns. With no such entry, nothing is spawned and the outfit can't dress a Fortnite character.
Applying the Outfit to a Character
To apply the outfit to a character, call SetCosmetic on the character's loadout component, passing the category and the outfit's class.
This snippet shows a custom verse device, DressUpComponent.verse, which applies the outfit at the start of the simulation step.
# DressUpComponent.verse
using { /UnrealEngine.com/Characters/Cosmetics }
using { /UnrealEngine.com/Characters/Cosmetics/Outfits }
using { /Verse.org/SceneGraph }
# Puts my_outfit on the character entity this component is attached to.
dress_up_component<public> := class<final_super>(component):
OnBeginSimulation<override>():void =
(super:)OnBeginSimulation()
How SetCosmetic behaves:
A loadout holds one cosmetic per category. Setting a category replaces whatever was in it.
It spawns the prefab. The loadout adds an instance of the cosmetic's
DefaultCosmeticStyleprefab as a child entity of the character, one per category.Setting a cosmetic with a different prefab removes the old instance and adds the new one. Setting one with the same prefab keeps the existing instance.
Setting one with no default prefab removes the category's instance.
An initial loadout authored on the component is applied when the component is added to the scene using the same path a runtime
SetCosmeticcall takes.Players are re-dressed in place. The outfit is an override on top of the player's own locker loadout, which is unchanged and is still theirs after they leave the island.
NPCs spawned by
fort_npc_componentare re-dressed in place, and later spawns wear the outfit.In the editor, the component shows a preview of the outfit on a mannequin in the level editor and the prefab editor, and reports the preview's bounds.
Only fort_outfit_cosmetic classes dress a Fortnite character. Any other cosmetic is recorded in the loadout and its prefab is spawned, but the character keeps its current look and a warning is logged.
Examples
Here is an example of how you can use Verse to dynamically assign outfits to characters and NPCs.
Dressing NPCs on Spawn
This component dresses its NPC when the game starts. Add it to the root entity of an NPC template that has a fort_cosmetic_loadout_component, such as guard_template. The NPC's current pawn is re-dressed, and later spawns wear the outfit.
using { /Fortnite.com/Characters }
using { /UnrealEngine.com/Characters/Cosmetics/Outfits }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }
# Dresses the NPC on this entity in my_outfit when the game starts.
npc_outfit_component := class<final_super>(component):
OnBeginSimulation<override>():void =
(super:)OnBeginSimulation()