# If I have an array containing items from several different base classes, is there a way to identify the specific base class an item is from and get its defaults?

**URL:** <https://forums.unrealengine.com/t/if-i-have-an-array-containing-items-from-several-different-base-classes-is-there-a-way-to-identify-the-specific-base-class-an-item-is-from-and-get-its-defaults/2700401>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [February 17, 2026, 10:59pm UTC](https://forums.unrealengine.com/t/if-i-have-an-array-containing-items-from-several-different-base-classes-is-there-a-way-to-identify-the-specific-base-class-an-item-is-from-and-get-its-defaults/2700401 "2026-02-17T22:59:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Killerbanaple](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Killerbanaple](https://forums.unrealengine.com/u/Killerbanaple)\
**Post date:** [February 17, 2026, 10:59pm UTC](https://forums.unrealengine.com/t/if-i-have-an-array-containing-items-from-several-different-base-classes-is-there-a-way-to-identify-the-specific-base-class-an-item-is-from-and-get-its-defaults/2700401/1 "2026-02-17T22:59:54Z")

</div>

I currently have an array called player equipables inventory which is the parent class for several subclasses (guns, melee items, equipment, etc). I would like to store items from each of these classes in a single array. Is there a way I can identify which subclass (guns vs melee vs equipment) so that I can reference the specific variables associated with each class while still storing these different items together in the same array?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/d/7/5d7048052b576e28ba1c5272c3385238b1fb3896.png)

---

<div class="post-metadata">

**Author:** ![AlienRenders](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AlienRenders](https://forums.unrealengine.com/u/AlienRenders)\
**Post date:** [February 18, 2026, 2:11am UTC](https://forums.unrealengine.com/t/if-i-have-an-array-containing-items-from-several-different-base-classes-is-there-a-way-to-identify-the-specific-base-class-an-item-is-from-and-get-its-defaults/2700401/2 "2026-02-18T02:11:15Z")

</div>

You’re storing the class objects instead of instances. If you store the instances, you can do GetClass on it and then check the class with a cast. What I tend to do is create an enum and add it as a member that is set by each class. Then you can use a switch node and then you can cast directly from each pin.

---

<div class="post-metadata">

**Author:** ![Killerbanaple](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Killerbanaple](https://forums.unrealengine.com/u/Killerbanaple)\
**Post date:** [February 20, 2026, 10:24pm UTC](https://forums.unrealengine.com/t/if-i-have-an-array-containing-items-from-several-different-base-classes-is-there-a-way-to-identify-the-specific-base-class-an-item-is-from-and-get-its-defaults/2700401/3 "2026-02-20T22:24:01Z")

</div>

This seems to be what I am looking for. I always understood casting as a way to get data directly from another blueprint (basically just having a blueprint reference without storing the variable) in a way often better done with interfaces. Is casting more commonly/better used to test the identify of a variable the intended application of the node?

---

<div class="post-metadata">

**Author:** ![AlienRenders](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AlienRenders](https://forums.unrealengine.com/u/AlienRenders)\
**Post date:** [February 20, 2026, 10:39pm UTC](https://forums.unrealengine.com/t/if-i-have-an-array-containing-items-from-several-different-base-classes-is-there-a-way-to-identify-the-specific-base-class-an-item-is-from-and-get-its-defaults/2700401/4 "2026-02-20T22:39:17Z")

</div>

In my example with the enum, you don’t cast to find out if it’s the right class. The enum does that. So you now know what type it is and you can safely cast to it to access its variables directly. Using casting to test if it’s a specific class is ok if done in isolation, but to test a bunch of classes, best to come up with an alternative method. Either have virtual methods, an interface or as in my example, an enum.

Also, casting isn’t about having a reference. It’s about what type you’re accessing. If class B derives from class A, you can access it as type A, but you don’t have access to functions in class B. So you can cast it to type B to have access to its functions and properties. How you make the determination if it’s of class B, that’s up to you and how you have things set up.

---

<div class="post-metadata">

**Author:** ![Countsie](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/countsie/32/1194632_2.png) [@Countsie](https://forums.unrealengine.com/u/Countsie)\
**Post date:** [February 20, 2026, 10:43pm UTC](https://forums.unrealengine.com/t/if-i-have-an-array-containing-items-from-several-different-base-classes-is-there-a-way-to-identify-the-specific-base-class-an-item-is-from-and-get-its-defaults/2700401/5 "2026-02-20T22:43:10Z")

</div>

Casting is effectively the same as checking for an interface. Interfaces are a pattern that allow you to decouple implementation from a definition, but aren’t ‘better’.

Casting is essentially saying ‘Treat this Object as this type if you can’ and is a pretty fast operation.
