Inventory system using lists

Let’s create a typical inventory system using lists using C#. To start, let’s create a simple item class.

Let’s create a gameobject and attach an item database script to it.

Now let’s create methods to add and remove items from this list.

Now let’s create a player object and add a script that stores inventory and can add/remove via function.

Now let’s create functionality inside off our add item database. We need to first check if we have the item in it already.

Now lets add the item to the object.

To remove items from a list, you would use the list name and delete. But for arrays, you need to set the item value to null.

To review — go to Practical Presentation Creating Inventory Item DB System.