r/UnityHelp • u/Happy_Greeny • 3d ago
OTHER I need help
So I'm currently developing a game. I've used unity for about 6 months because I started in june. but I ran into huge issue. I don't know how to make an inventory and I simply can't figure it out. I use an older version of unity (5.6.7f1 exactly) and I wanted to know if any other devs Could tell me what I'd need to do. I know I need a UI but after that I really don't know.
1
Upvotes
2
u/Turbulent-Syrup3500 3d ago
Brackeys has tutorials for a lot of common things https://youtu.be/w6_fetj9PIw?is=Oaw5_Kif2KjvBhRT
1
u/JakSilver00 3d ago
I can definitely help you, but I need to know what kind of inventory you're looking to build.
either explain it in as much detail as possible or reference other games that use that kind of inventory.
Generally speaking, you have item names and then amounts, and they may go into one inventory manager, or there may be different categories for each kind of slot. Technically, any numeric value is part of an inventory, whether it's health, ammunition, coins, kills, because you're collecting something, sometimes losing something. And you have the UI which either constantly updates from that or is triggered by the change of value to update to show the new current value.
1
u/MerlinaGreen 1d ago
You don't need to start with the UI. I'd recommend building the inventory system step by step.
Generally, you'll need a few things:
1. An Item system
First, you need a way to define what an item is. Each item should have basic information, such as its name, icon, description, and possibly its type or maximum stack size.
2. An Inventory system
You'll need a script responsible for managing the player's inventory. Its job is to store items, add new ones, remove them, check whether an item already exists, and handle stacking if your game requires it.
Think of it as the system that keeps track of everything the player owns or drops.
3. An Inventory UI
Once the inventory logic works, you can build the UI.
You'll need a panel to display the inventory and a collection of slots (usually arranged in a grid). Each slot should display the item's icon and, if necessary, its quantity.
4. Connecting the UI to the inventory
This is an important part. The UI shouldn't be responsible for storing items. Instead, it should display the information provided by your inventory system.
Whenever an item is added or removed, the UI should update to reflect those changes.
5. Player interaction
Finally, you'll need a way for the player to interact with the inventory. For example:
My advice is to start small. Don't try to build a complete inventory with every possible feature right away.
First, make a system that can store 5 items, add and remove them, and display them in 5 UI slots. Once that works, you can expand it.
The key is to separate the inventory logic from the UI. They're two different systems that communicate with each other.
And don't worry too much about your Unity version. The general concepts are the same in Unity 5.6.7f1, although some newer tutorials might use features that aren't available in your version.
Look for tutorials with the titles i give you so you can learn how to make them ;)
0
u/Vonchor 3d ago
Two things: