🧢 Adding a New Accessory
In the Virtual Pet Game Template, you can define clothing and appearance overrides for pets using the PetClothesData ScriptableObject. These items can be purchased, equipped, and rendered on the pet using the integrated UI and PetModel system.
🎨 What is PetClothesData?
PetClothesData?The PetClothesData object defines:
A unique item ID
A shop icon, localized name and description
Shop data like price, currency ID, and type (normal/premium)
A slot type (e.g.,
"Hat","Glasses","Shirt")Optionally, a pet color override
When equipped, this item will be rendered on the correct part of the pet if the PetModel prefab has an associated object for the item ID in the correct slot.
📌 Registering in GameInstance
After creating the PetClothesData asset, you must add it to the GameInstance under the array petClothesData.
GameInstance.Instance.petClothesDataThis is required so the item can be recognized by the shop, inventory, and equipped correctly by the player.
🧩 How to Create a New Accessory
Right‑click in the Project panel → Create → PetCareGame → Pet Clothes Data
Fill in the following fields:
FieldDescriptionitemIdUnique identifier, used in save/load
itemIconDisplay icon in shop
itemNameLocalized name using
NameTranslatedByLanguageitemDescriptionLocalized tooltip
currencyIdCurrency to buy this item (e.g.,
"GO")itemPricePrice for this item
clothBuyTypeNormal or Premium
overridePetColorIf true, pet color is replaced
overrideColorThe new color applied when equipped
clothSlotTypeSlot category (e.g.,
"Hat","Back","Glasses")
🎨 Color Override (optional)
If overridePetColor is enabled, this item will change the base color of the pet when equipped. The color is restored when the item is unequipped.
🧠 How It Works
When a pet is spawned via
GameInstance.InstantiatePetModel(), the pet loads all currently equipped items fromPlayerSave.For each
clothSlotType, it searches the corresponding slot on thePetModel.objectsToActivatelist.It activates the
CharacterObjectwhoseitemIdmatches.If
overridePetColoris true, it callsPetModel.UpdateColor().
✅ Example Usage
To equip a saved item, the system internally uses:
And on the PetModel, it automatically activates:
You only need to ensure the item ID matches the one defined in the prefab.
Last updated