Ultimate Inventory System WIP

Justin

Administrator
Staff member
For the past few weeks we have been polishing up the asset and @Sangemdoko has been writing the documentation. A pre-release this month is still looking good. Notable changes from the last update is that we now require a minimum Unity version of 2019.3. In 2019.3 the styling dramatically changed and it was going to be a lot of work to get both styles working well so we thought that we would just look towards towards future and require a minimum version of 2019.3.

I thought that I would give a brief overview of the Ultimate Character Controller integration since we haven't touched on that at all. The demo scene is still being polished so things may change a bit but the functionality is all there and will not change. The integration will require version 2.2.1 of the character controller.

To get started lets look at the where you'll begin: the Integrations Manager of the Ultimate Character Controller. Similar to a lot of the existing editors for the character controller, you can just drag your character into the field and it will add the appropriate components:



When the character has been setup and you click on the character you'll notice that the Ultimate Character Controller inventory has been replaced by the Ultimate Inventory System Inventory, and an Ultimate Inventory System Bridge component has been added. The Item Set Manager has also been replaced by the Inventory Item Set Manager.

Inventory



The Inventory component will contain four Item Collections: Default, Equippable, Equipped, and Loadout.

Default: The consumable items as well as the items that the character controller doesn't need to be made aware of, such as any armor.
Equippable: The items that can be equipped by the character.
Equipped: The items that are currently equipped by the character, using slots so different items can be equipped in different locations.
Loadout: The items that should be added when the character spawns.

Ultimate Inventory System Bridge

This component is the bridge between the Ultimate Inventory System and the character controller. At a high level this component is responsible for determining what Item Collection the item should be placed in. This component implements the Ultimate Character Controller InventoryBase component.



The integration uses categories in order to determine what Item Collection the item should be placed in. The Multi Item Category is a special category that allows for a single Item Definition to be used in multiple slots, such as a left/right handed grenade or dual wielding pistols.

Inventory Item Set Manager

The Inventory Item Set Manager implements the Item Set Manager Base component. This component is responsible for organizing the equip order of the items. One common piece of feedback we heard was that some people don't like this component because it makes managing many items difficult. In version 2.2 we (hopefully!) solved this issue by allowing for new Item Sets to be added based on the order of the existing Item Set. As an example, in the demo scene we have two types of swords: a regular sword and an Excalibur. The Item Set Manager only contains the ordering for the Sword, but because the Excalibur Item Definition is a child of the Sword it will add any new Item Definitions in a similar order. This even works with with dual wielding items.



Use Cases

For this integration we wanted to cover all known use cases, and so the demo scene will show:

- Pickup on Button Press
- Use Pickup Item Ability
- Pickup Dual Wield Pistols
- Limited Category Items (in the demo scene you can only own one sword at a time)
- Equip from Menu
- Grenades (two item instances on the same Item Definition, but can only equip one at a time)
- Unequip to default inventory
- Drop

We'll have more details on how to setup all of these features in the docs. We're excited to be getting close to this pre-release!
 

Duffer123

Member
@Justin ,

Looking good!

In terms of UIS Item Categories though, do we need to adhere to the above 4/5 Item Categories as parent Item Categories (or some of them) in our Schema (hierarchy of Item Categories in UIS) to get our Items from UIS to work correctly with UCC? (hope you see what I am getting at).
 

Justin

Administrator
Staff member
The equippable, consumable, and (if used) multi item categories will need to be specified by the bridge so they will need to be the parent of those types of items. With the parenting system though this isn't an issue since you can then have any organization that makes sense for your game.
 

Christopher25

New member
can you explain this part please

[22:27]


in this article you said that the combination of items depends on the order of items. I don't understand this, sorry I'm not a native speaker. in the screenshot you showed the opposite of that what I understood.

In my point of view we have abtract item types like "sword" or "shield"or "Bow" and "arrow/quiver"
but you also set a specific item from type "sword" to the list that it can stand alone or can be combined with a shild.
This is not logical for me.
 
Last edited:

Sangemdoko

Moderator
Staff member
Hi @Christopher25

The image shows the item sets at runtime. So as you pointed it out Excalibur and Sword both have the same arrangement of item sets. Right hand alone or with a shield.

In the editor (before you press play) the item set only needs to know about the "abstract" item definition you mentioned (like the "sword", "shield", etc...). In the integration "Excalibur" is a child of the "Sword" item definition.

When you equip an item such as a sword the item set will hold a reference to the item equipped. If your character picks up another sword it will automatically duplicate the itemSets to hold a reference to both sword items.

Once you pick up the Excalibur sword the itemSets will detect that it is a child of the "sword" ItemDefinition, and therefore it knows which itemSets needs to be created from the "sword" item sets.

This workflow should make things a lot faster as you would only need to specify the item sets for the parent itemDefinitions and the system will work it out automatically for their children.

I hope that makes sense
 

Sangemdoko

Moderator
Staff member
We haven't started working on the integration with third party assets yet. We will look into an integration with UMA in the future. I'm not sure when we'll start working on integration or how long it will take to complete. In depends on how the asset is received by the community and how much additional features are requested.
 

Duffer123

Member
@Sangemdoko , so parent Item Definitions and Item Sets allow you to shortcut a whole lot of stuff with UCC in terms of how items behave and are equipped? In which case, sweeeet.... ;)
 

Sangemdoko

Moderator
Staff member
Hi @VintageRoots , We are working on the final touches to polish things up. The pre-release will come out in the next few weeks around the end of May. Once it is out we'll announce it here and on Discord. I hope you are looking forward to it as much as we do :)
 

Duffer123

Member
@Sangemdoko , in terms of third party and home-coded UI, it will be helpful to access many Item Attribute values by type easily and with the API? - but, with UI, in particular Sprites and Prefab values?
 

Sangemdoko

Moderator
Staff member
@Duffer123 I'm not completely sure I follow your question but in case you are asking how to get the attribute value of an item through code you have a few options. You'll learn more about those in the documentation once it comes out. If you are only interested by the value of a sprite attribute called "Icon" you could simply do this:

C#:
if (m_Item.TryGetAttributeValue("Icon", out Sprite icon)) {
   m_ItemIcon.sprite = icon;
}
 

GreedyVox

New member
Hi, just purchased the Ultimate Character Controller (UCC) and have just found out about your inventory system project that integrates with the controller, forgive me for not researching and reading through all the post here, but my six week old son wanting my intention and my time. I have couple of questions of interest in your project and hope you can spare the time to help.

We have made a prototype game called YAARRGH! We have also starting to make the prototype into a game, I made a inventory system for the prototype but need to redo for the game and integrating with the UCC, was wondering if its possible to achieve my concepts with your inventory system framework, such as a inventory for objects such as a chess and then moving items between inventories.

Linking two bookmarks to my video of the prototype to help explain my concepts.

Moving items to object inventory

Moving items between inventory
 

Sangemdoko

Moderator
Staff member
Hi @GreedyVox Thank you for showing interest in the new inventory system.

Our inventory system was built in a very modular and scalable way so that it could be accommodated for any type of game. You can add inventories to anything as it is a Component (Monobehavior). So having inventories for your character and chests is very simple.
Of course some use cases may require more custom code than others.

From what I see in your devlogs there are a few things that our inventory system does not do (yet) but you should be able to implement by porting over some of your code.

1) We made our UI so that it works seamlessly with both mouse/keyboard and controller. That means we did not implement any drag and drop functionality.
2) Since we did not implement drag and drop we did not implement a UI where you can set your items in a specific place within a grid, instead we add items one after the other and sort them by name or by category. This is something that I plan to implement at some point in the near future.

So if you wish to have the exact same functionality as you have in your devlogs by using UIS you'll need to solve these two things. Since your game already has drag and drop that's something you could simply port over.

What would require a bit more thought will be the how the inventory stores your items. The simplest solution would be to create a custom itemCollection with a fixed number of item slots (That is very simple and I may add it directly in the asset right now). From there it is just a question of setting the items to the correct item slot when you move them around. That is very easy. When you add, remove or give items you can choose in which item slot the item should be added/removed.
There could be other solutions like having a custom Inventory component that keeps track of item placement in the UI by using an index.

Once the asset is pre-released we will be listening to the users feedback attentively and if there is enough demand for certain features we will try to implement them directly in the asset. Otherwise we will help you implement it yourself by guiding you in the forum.

I hope that answers some of your concerns.

We will be sharing more information about UIS very soon so stay tuned.
 

GreedyVox

New member
1) We made our UI so that it works seamlessly with both mouse/keyboard and controller. That means we did not implement any drag and drop functionality.
2) Since we did not implement drag and drop we did not implement a UI where you can set your items in a specific place within a grid, instead we add items one after the other and sort them by name or by category. This is something that I plan to implement at some point in the near future.

So if you wish to have the exact same functionality as you have in your devlogs by using UIS you'll need to solve these two things. Since your game already has drag and drop that's something you could simply port over.

What would require a bit more thought will be the how the inventory stores your items. The simplest solution would be to create a custom itemCollection with a fixed number of item slots (That is very simple and I may add it directly in the asset right now). From there it is just a question of setting the items to the correct item slot when you move them around. That is very easy. When you add, remove or give items you can choose in which item slot the item should be added/removed.
There could be other solutions like having a custom Inventory component that keeps track of item placement in the UI by using an index.

Thank you Sir!
Its hard for me to sit down and get work done, as my boy is very demanding, so thank you for taking the time to answer my question with such detail, I do hope you add these features in the future, as I will be very interested, currently just starting to build the game network framework using Unity NetCode infrastructure and have time before needing a Inventory System, I like what your project is doing and works out of the box with UCC.

From memory and without checking my code, if I'm correct cause it was awhile ago, when I made the prototype Inventory, think I used an item collection (1D Array) for the Inventory grid that read/write XML files, with module indexing for moving items around the grid, was a pretty robust system.

I do have a couple of dumb question, but I need to ask, just for clarity:
Does one create a Inventory root Canvas? Or have access to the Inventory root Canvas render mode?
Is the system using Unity DOTS?
 

Sangemdoko

Moderator
Staff member
Hi @GreedyVox

I am not sure what you mean by inventory root canvas. In our demo scene for the asset we have a single canvas for all our menus: Main menu, Inventory, Shop, Crafting, etc... We use the Unity UI system so you should be familiar with how things are set up and how to customize it.

Also since our UI is modular you could replace it by your own UI without any problems.

Our system does not use DOTS. DOTS is a feature in preview and will most likely change a lot before it gets stable. And we believed it did not make sense to use DOTS for our inventory system.
 

GreedyVox

New member
Hi @GreedyVox

I am not sure what you mean by inventory root canvas. In our demo scene for the asset we have a single canvas for all our menus: Main menu, Inventory, Shop, Crafting, etc... We use the Unity UI system so you should be familiar with how things are set up and how to customize it.

Thank you again Sir,
My bad, wasn't very clear on my questions, however you still answers correctly, I understand the optimizing reason for a single canvas, what you doing is the best solution for the Inventory UI, however to achieve my effects for a chess inventory, had to use multiple canvas, one for each object.

The illusion of items inside a chess.
Chess Inventory UI rendered in world space, with items rendered as sprites.

Screenshot from 2020-05-19 22-00-16.png Screenshot from 2020-05-19 21-59-38.png Screenshot from 2020-05-19 22-03-53.png

With the Inventory System:
Would this be plausible? Multiple UI Canvas independent of each other?
 

Sangemdoko

Moderator
Staff member
Hi @GreedyVox

Absolutely. There is no restriction on how you display your inventories. You just need to reference an inventory component (drag and drop the inventory component in the inspector) in the Inventory Grid UI component which can be set in any canvas.

To display things exactly like you wish may require some custom code but nothing complicated. We can guide you in the forums if you end up having issues.

If you wanted you could even display your items in the chests as 3D/2D game objects. That would require a fair bit more of custom code but it may suit your use case better.

I hope that answers your concerns
 
Top