ItemPantsAsset — Pants Clothing Definition
Overview
ItemPantsAsset defines a wearable pants/legs item in Unturned. It inherits from ItemBagAsset (storage dimensions), which inherits from ItemClothingAsset (armor, proof system, movement speed), which inherits from ItemAsset. The class loads three optional 2D textures (Pants, Emission, Metallic) from the master bundle and applies them to the character's lower body mesh.
Compared to ItemShirtAsset, the pants class is simpler: no mesh override system, no material override, no character body mesh replacement. Pants provide texture overlay only on the character's leg mesh.
Pants occupy the EItemType.PANTS slot and are one of four slot types eligible for armor damage reduction.
Source code location: Unturned/Bundles/ItemPantsAsset.cs (77 lines), inheriting from ItemBagAsset.cs (52 lines), ItemClothingAsset.cs (304 lines), and ItemAsset.cs (base).
Inheritance Chain
ItemAsset
└─ ItemClothingAsset (abstract) — armor, proof, movement speed, visuals
└─ ItemBagAsset (abstract) — storage dimensions (Width, Height)
└─ ItemPantsAsset — pants/emission/metallic texturesClass Definition
csharp
public class ItemPantsAsset : ItemBagAsset
{
protected Texture2D _pants;
public Texture2D pants => _pants;
protected Texture2D _emission;
public Texture2D emission => _emission;
protected Texture2D _metallic;
public Texture2D metallic => _metallic;
public override void PopulateAsset(in PopulateAssetParameters p) { ... }
}The class is 77 lines — the smallest of the clothing subclasses that loads its own assets. It has no ClothingPrefab override (the base ItemClothingAsset.ClothingPrefab returns null), no BuildDescription override, and no getState override.
Texture Loading
Pants Texture
csharp
_pants = loadRequiredAsset<Texture2D>(p.bundle, "Pants");The "Pants" texture is required — loadRequiredAsset fails with an error if missing. This is the base color/diffuse map applied to the character's leg mesh.
Validation:
csharp
if (pants != null && Assets.shouldValidateAssets)
{
if (pants.isReadable)
Assets.ReportError(this, "texture 'Pants' can save memory by disabling read/write");
if (pants.format != TextureFormat.RGBA32 && pants.format != TextureFormat.RGB24
&& (pants.width <= 128 || pants.height <= 128))
Assets.ReportError(this, $"texture Pants might look weird because it is relatively "
+ $"low resolution but has compression enabled ({pants.format})");
}| Check | Condition | Warning |
|---|---|---|
| Read/write | pants.isReadable == true | Memory waste — CPU-side copy doubles memory |
| Format + resolution | Format is not RGBA32/RGB24 AND ≤128px | Compression artifacts at low resolution |
Emission Texture
csharp
_emission = p.bundle.load<Texture2D>("Emission");Optional glow map. Returns null if absent.
Validation:
csharp
if (emission != null && Assets.shouldValidateAssets)
{
if (emission.isReadable)
Assets.ReportError(this, "texture 'Emission' can save memory by disabling read/write");
if (emission.width <= 128 || emission.height <= 128)
{
if (emission.format == TextureFormat.RGBA32)
Assets.ReportError(this, $"texture Emission is relatively low resolution so RGB24 format is recommended");
else if (emission.format != TextureFormat.RGB24)
Assets.ReportError(this, $"texture Emission might look weird because it is relatively low resolution but has compression enabled ({emission.format})");
}
}For low-resolution emission textures, RGB24 is recommended over RGBA32 — the alpha channel is unused in emission maps. Compressed formats at low resolution cause visible block artifacts.
Metallic Texture
csharp
_metallic = p.bundle.load<Texture2D>("Metallic");Optional metallic/smoothness map. Returns null if absent. Unlike emission textures where RGB24 is acceptable for low-res, metallic textures should prefer RGBA32 because the alpha channel carries smoothness data.
Validation:
csharp
if (metallic != null && Assets.shouldValidateAssets)
{
if (metallic.isReadable)
Assets.ReportError(this, "texture 'Metallic' can save memory by disabling read/write");
if (metallic.format != TextureFormat.RGBA32 && (metallic.width <= 128 || metallic.height <= 128))
Assets.ReportError(this, $"texture Metallic might look weird because it is relatively low resolution but has compression enabled ({metallic.format})");
}Texture Loading Conditions
| Condition | Pants | Emission | Metallic |
|---|---|---|---|
| Required | Yes | No | No |
| Server skip | Yes | Yes | Yes |
| Read/write warning | Yes | Yes | Yes |
| Resolution warning | Yes | Yes | Yes |
| Format rec. | RGBA32/RGB24 | RGB24 for low-res | RGBA32 for alpha |
All texture loading is skipped on dedicated servers:
csharp
if (!Dedicator.IsDedicatedServer)
{
// Load textures...
}The server does not need visual textures — it only needs the .dat values.
Storage Dimensions (Inherited from ItemBagAsset)
Pants inherit inventory storage from ItemBagAsset:
| .dat Key | Type | Default | Range |
|---|---|---|---|
Width | byte | 0 | 0–255 |
Height | byte | 0 | 0–255 |
PRO items have storage forced to 0:
csharp
if (!isPro)
{
_width = p.data.ParseUInt8("Width");
_height = p.data.ParseUInt8("Height");
}Storage display in tooltip:
csharp
if (width > 0 && height > 0)
{
builder.Append(localization.format("ItemDescription_StorageDimensions", width, height), DescSort_Important);
}Example display: Storage: 3 × 2
Inherited Behavior: ItemClothingAsset
Armor System (Pants Are Eligible)
Pants are one of four slot types eligible for armor. The BuildDescription armor section only shows for HAT, SHIRT, PANTS, and VEST:
csharp
if (type == EItemType.HAT || type == EItemType.SHIRT || type == EItemType.PANTS || type == EItemType.VEST)
{
if (_armor != 1.0f) { /* show armor */ }
if (_explosionArmor != 1.0f) { /* show explosion armor */ }
}Proof System
| .dat Key | Behavior |
|---|---|
Proof_Water | No drowning damage |
Proof_Fire | Fire immunity |
Proof_Radiation | Radiation immunity |
All proof flags are read via ContainsKey — presence sets the flag.
Movement Speed
| .dat Key | Type | Default |
|---|---|---|
Movement_Speed_Multiplier | float | 1.0 |
Pants movement speed compounds with the equipableMovementSpeedMultiplier from ItemAsset.
Visual Fields
| .dat Key | Type | Default | Pants relevance |
|---|---|---|---|
Hair_Visible | bool | true | Low — pants don't cover head |
Beard_Visible | bool | true | Low — pants don't cover face |
Visible_On_Ragdoll | bool | true | Standard |
Mirror_Left_Handed_Model | bool | true | Low — pants are symmetric |
Skin_Override | string | null | Standard — child mesh skin material |
Destroy_Clothing_Colliders | bool | true | Standard |
Priority_Over_Cosmetic | bool | false | Standard |
Wear Audio
Pants default to the sleeve rustle sound:
csharp
wearAudio = new AudioReference("core.masterbundle", "Sounds/Sleeve.mp3");Override with WearAudio in the .dat file.
PRO vs Non-PRO Behavior
| Feature | Non-PRO Pants | PRO Pants |
|---|---|---|
| Armor values | Parsed from .dat | Forced to 1.0 |
| Storage dimensions | Parsed from .dat | Forced to 0 |
| Texture loading | Normal | Normal |
| Cosmetic preview | — | CosmeticPreviewOverride loaded |
PopulateAsset Call Chain
ItemAsset.PopulateAsset — GUID, Type, Slot, Size_X/Y/Z, Rarity, IsPro, blueprints, etc.
└─ ItemClothingAsset.PopulateAsset — Armor, Armor_Explosion, Falling_Damage_Multiplier, Proof flags,
Movement_Speed_Multiplier, Visible_On_Ragdoll, Hair_Visible/Beard_Visible,
Mirror_Left_Handed_Model, WearAudio, Destroy_Clothing_Colliders,
Priority_Over_Cosmetic, Skin_Override, cosmeticPreviewModelOverride
└─ ItemBagAsset.PopulateAsset — Width, Height
└─ ItemPantsAsset.PopulateAsset
├─ Load "Pants" texture (required) + validation
├─ Load "Emission" texture (optional) + validation
└─ Load "Metallic" texture (optional) + validationBuildCargoData — Wiki Export
Pants contribute to two Cargo tables:
Clothing table (from ItemClothingAsset)
GUID, Armor, Armor_Explosion, Falling_Damage_Multiplier, Proof_Water, Proof_Fire, Proof_Radiation, Prevents_Falling_Broken_Bones, Movement_Speed_Multiplier, Mirror_Left_Handed_Model, Priority_Over_Cosmetic.
Bag table (from ItemBagAsset)
| Column | Source |
|---|---|
GUID | PK, FK to Clothing |
Width | _width |
Height | _height |
Comparison: Pants vs Shirt
| Feature | ItemPantsAsset | ItemShirtAsset |
|---|---|---|
| Line count | 77 | 209 |
| Base class | ItemBagAsset | ItemBagAsset |
| Textures | Pants, Emission, Metallic | Shirt, Emission, Metallic |
| Mesh override | No | Yes (1P/3P LODs) |
| Material override | No | Yes |
| Ignore hand flag | No | Yes |
| ClothingPrefab | null (from base) | null (from base) |
| Server loading | Skip textures | Skip textures + null mesh/mat |
| Complexity | Low | High |
.dat File Reference — Pants-Specific
| .dat Key | Type | Default | Category |
|---|---|---|---|
Armor | float | 1.0 | Damage mitigation (PANTS slot applies) |
Armor_Explosion | float | equals Armor | Explosion-specific armor |
Falling_Damage_Multiplier | float | 1.0 | Fall damage scalar |
Proof_Water | flag | — | Water breathing |
Proof_Fire | flag | — | Fire immunity |
Proof_Radiation | flag | — | Radiation immunity |
Prevents_Falling_Broken_Bones | bool | false | No fall bone breaks |
Movement_Speed_Multiplier | float | 1.0 | Movement speed modifier |
Hair_Visible | bool | true | Show character hair |
Beard_Visible | bool | true | Show character beard |
Visible_On_Ragdoll | bool | true | Visible on death |
Mirror_Left_Handed_Model | bool | true | Mirror for left-handed |
WearAudio | AudioReference | Sounds/Sleeve.mp3 | Equip sound |
Destroy_Clothing_Colliders | bool | true | Remove colliders |
Priority_Over_Cosmetic | bool | false | Override cosmetic |
Skin_Override | string | — | Child mesh for skin material |
Width | byte | 0 | Storage columns |
Height | byte | 0 | Storage rows |
Master Bundle Asset Requirements
| Bundle Key | Type | Required | Purpose |
|---|---|---|---|
"Pants" | Texture2D | Required | Base color/diffuse for legs |
"Emission" | Texture2D | Optional | Glow map for legs |
"Metallic" | Texture2D | Optional | Metallic/smoothness for legs |
Unlike shirts and hats, pants do not use a 3D prefab. The textures are applied to the existing character leg mesh. No "Pants" GameObject is expected — the key maps to a Texture2D asset.
Modding Example — Basic Cargo Pants .dat
ini
GUID a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6
Type Pants
Rarity Common
Size_X 2
Size_Y 2
Armor 0.95
Width 3
Height 2Bundle contents: Pants (Texture2D, RGBA32, 512×512).
Creates common pants with:
- 5% damage reduction
- 3×2 storage grid (6 slots)
- No emission or metallic effects
Modding Example — Armored Leggings .dat
ini
GUID f1e2d3c4b5a69788796a5b4c3d2e1f0a
Type Pants
Rarity Epic
Size_X 3
Size_Y 2
Armor 0.80
Armor_Explosion 0.75
Movement_Speed_Multiplier 0.90
Width 4
Height 3
Proof_FireBundle contents: Pants (Texture2D), Emission (Texture2D), Metallic (Texture2D).
Creates heavy armored leggings with:
- 20% general damage reduction
- 25% explosive damage reduction
- 10% movement speed penalty
- 4×3 storage grid (12 slots)
- Fire immunity
- Full PBR material (diffuse + emission + metallic)
Modding Example — Minimal Pants .dat
ini
GUID d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9
Type Pants
Rarity Uncommon
Size_X 2
Size_Y 1
Armor 1.0
Width 1
Height 1Bundle contents: Pants (Texture2D, RGB24, 256×256).
Minimal pants with:
- No damage reduction (purely cosmetic)
- 1×1 storage (single slot)
- Small 256×256 texture
Common Issues
Texture not appearing: Verify the
"Pants"key matches exactly (case-sensitive). Unlike hats which load"Hat"as a GameObject, pants load"Pants"as a Texture2D — a wrong type will cause a load failure.Read/write memory waste: Disable read/write on pants textures. With it enabled, each texture uses double the GPU memory. The validation warns about this when
-ValidateAssetsis active.Low-resolution compression artifacts: Pant textures ≤128px in either dimension should use uncompressed formats (
RGBA32orRGB24). Compressed formats (DXT1/DXT5) at low resolution cause visible block artifacts.Emission texture format: For emission textures at ≤128px, use
RGB24instead ofRGBA32— the alpha channel is unused for emission maps.Metallic texture format: Use
RGBA32for metallic textures — the alpha channel carries smoothness data.RGB24would lose this information.PRO pants storage: PRO items have
WidthandHeightforced to0. If pants need storage, use a non-PRO item type.Armor not stacking: Armor from pants multiplies with armor from other slots. A shirt with
Armor 0.8and pants withArmor 0.8produce0.8 × 0.8 = 0.64(36% reduction), not1 - (0.2 + 0.2) = 0.6(40% reduction).
Document history
| Version | Date | Author | Notes |
|---|---|---|---|
| 1.0 | 2026-07-28 | 57 Studios | Initial publication. Full pants asset documentation including texture validation, storage dimensions, and modding examples. |
