Class Inheritance

We can have classes that inherit the information of other classes. To start, let’s create an item class.

Once this is created, let’s create a weapons class. In order to inherit the Item class, we need to replace monobehavior with the Item class.

We can also have a consumable class as well which is also an item (a subcategory) that pulls from item.

Now if we create a new item database and add the system.serializable into the classes, I can view the base (items) and the subcategories (weapons and consumables) and those have the item elements as well!

This is how you can scale items for your database with clean code!