๐ How to Add a New Food Item
This page guides you through the process of creating and configuring a new food item in the game using the FoodData system.
๐งพ Step-by-Step Instructions
1. Create the Food Asset
Right-click in the Project window โ
Create
โPetCareGame
โFood Data
Fill in the following fields:
foodId
Unique ID for this food (must not conflict with others)
foodIcon
Sprite to display in the inventory/shop
foodName
Localized name (multi-language support)
foodDescription
Tooltip/description text
currencyId
Currency required to buy this food (e.g. "GO"
)
price
Cost of the food in the chosen currency
expWhenEating
EXP gained when pet consumes this item
petStats
Stats restored (e.g., Hunger, Energy)
2. Configure Pet Preferences
You can define how much each pet likes or dislikes this food using the preferences
list.
Each entry links a petId
to a PreferenceLevel
:
Dislike
Very low chance to eat (unless starving)
Neutral
Standard acceptance chance
Like
High chance to eat and visual feedback
โ ๏ธ If a petId is not listed, the food will use a default neutral chance.
3. Add to GameInstance
To make the new food available in the game:
Open the
GameInstance
Component in Home SceneAdd your new
FoodData
to thefoodData
array:
This allows the system to load and display the food in shops, menus, and when handling feeding actions.
โ
Summary
Multi-language food names
โ
EXP on consumption
โ
Per-pet preferences
โ
Stat gain on use
โ
Shop integration
โ
Currency support
โ
You can now create dozens of foods with different effects and make each pet respond uniquely to them!
Last updated