# Get class of actor?

**URL:** <https://forums.unrealengine.com/t/get-class-of-actor/339229>\
**Category:** Editor Scripting\
**Tags:** actor, Class, inventory, aactor, unreal-engine, CPP, question\
**Created:** [November 21, 2015, 8:24am UTC](https://forums.unrealengine.com/t/get-class-of-actor/339229 "2015-11-21T08:24:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dirt113](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dirt113](https://forums.unrealengine.com/u/Dirt113)\
**Post date:** [November 21, 2015, 8:24am UTC](https://forums.unrealengine.com/t/get-class-of-actor/339229/1 "2015-11-21T08:24:00Z")

</div>

Is there a way to get the class of an AActor except for manually casting it to every single subclass, nor enumerations with the type of the actor as a variable?

I need this for my inventory system

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e1690214](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e1690214](https://forums.unrealengine.com/u/anonymous_user_e1690214)\
**Post date:** [November 21, 2015, 11:43pm UTC](https://forums.unrealengine.com/t/get-class-of-actor/339229/2 "2015-11-21T23:43:16Z")

</div>

Well, `MyActor->GetClass()` should work. Is that not giving you what you need?

---

<div class="post-metadata">

**Author:** ![nmm131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nmm131](https://forums.unrealengine.com/u/nmm131)\
**Post date:** [November 22, 2015, 12:51am UTC](https://forums.unrealengine.com/t/get-class-of-actor/339229/3 "2015-11-22T00:51:25Z")

</div>

GetActorOfClass

Or put all actor classes inside an index.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e1690214](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e1690214](https://forums.unrealengine.com/u/anonymous_user_e1690214)\
**Post date:** [November 22, 2015, 1:39am UTC](https://forums.unrealengine.com/t/get-class-of-actor/339229/4 "2015-11-22T01:39:02Z")

</div>

That finds an actor given a class, rather than finding the class of a particular actor.

---

<div class="post-metadata">

**Author:** ![DivideByZero](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DivideByZero](https://forums.unrealengine.com/u/DivideByZero)\
**Post date:** [November 23, 2015, 9:48am UTC](https://forums.unrealengine.com/t/get-class-of-actor/339229/5 "2015-11-23T09:48:33Z")

</div>

could try  
if (MyActor-\>IsA(AWeaponActor::StaticClass()))

---

<div class="post-metadata">

**Author:** ![Tom8788](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tom8788](https://forums.unrealengine.com/u/Tom8788)\
**Post date:** [August 19, 2022, 3:33pm UTC](https://forums.unrealengine.com/t/get-class-of-actor/339229/6 "2022-08-19T15:33:58Z")

</div>

In blueprints there’s a node called “get class”, under utilities

---

<div class="post-metadata">

**Author:** ![Momonks5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Momonks5](https://forums.unrealengine.com/u/Momonks5)\
**Post date:** [February 16, 2024, 10:56am UTC](https://forums.unrealengine.com/t/get-class-of-actor/339229/7 "2024-02-16T10:56:37Z")

</div>

I spent ages trying to solve this as I have an array of actors with tag and want to spawn a random actor. So I needed to plug an actor into the class plug on SpawnActor.  
It turns out all you need to do is plug your actor into the class plug and UE adds the conversion node…
