Integrating Enums and Classes

Al Heck
Oct 19, 2021

Let’s say we wanted to create an item class and we wanted to browse through our items using an enum dropdown list. Here’s how we setup the class.

Now we need a database to connect to.

Now we can fill in the item database using an enum

We can then create a action function that identifies/applies an item depending if it’s a certain type of item. For now, we are just debug.logging what type of item it is.

Then we want to grab our item DB, reference 0 in the list, and perform the action function which identifies if it’s 0, let us know it’s a weapon.

--

--

Al Heck

Unity Developer and Software Engineer who loves making games with GameDevHQ