# Which is better? create 4 class or 1 class for 4 similar actor?

**URL:** <https://forums.unrealengine.com/t/which-is-better-create-4-class-or-1-class-for-4-similar-actor/2213032>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [December 12, 2024, 4:49pm UTC](https://forums.unrealengine.com/t/which-is-better-create-4-class-or-1-class-for-4-similar-actor/2213032 "2024-12-12T16:49:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sor9ryINoob](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sor9ryINoob](https://forums.unrealengine.com/u/Sor9ryINoob)\
**Post date:** [December 12, 2024, 4:49pm UTC](https://forums.unrealengine.com/t/which-is-better-create-4-class-or-1-class-for-4-similar-actor/2213032/1 "2024-12-12T16:49:57Z")

</div>

Hello, I am new to programming, I am trying to create a game that when I press 1, i am changing location of actorA, press 2 change actorB and so on. Should I create 4 different class for each actor for simplier programming or create 1 class and use interface to command each actor?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 12, 2024, 5:13pm UTC](https://forums.unrealengine.com/t/which-is-better-create-4-class-or-1-class-for-4-similar-actor/2213032/2 "2024-12-12T17:13:42Z")

</div>

You make one class which responds to commands ( given parameters ), and drag 4 copies of it into the map 🙂

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [December 12, 2024, 5:15pm UTC](https://forums.unrealengine.com/t/which-is-better-create-4-class-or-1-class-for-4-similar-actor/2213032/3 "2024-12-12T17:15:43Z")

</div>

> [@Sor9ryINoob](#):
>
> use interface to command each actor?

What @ClockworkOcean said + no interface needed if just changing transform.

---

<div class="post-metadata">

**Author:** ![CodeWizard1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CodeWizard1](https://forums.unrealengine.com/u/CodeWizard1)\
**Post date:** [December 12, 2024, 5:16pm UTC](https://forums.unrealengine.com/t/which-is-better-create-4-class-or-1-class-for-4-similar-actor/2213032/4 "2024-12-12T17:16:12Z")

</div>

One Actor.You can use getallactorsofclass node in blueprints. you can use get or you can rename all of these actors in world hierarchy and you can make array with discover on spawn and instance editable. You can assign all of actors with its name or you can make four variables with same properties as array too and you set actor location and actor input is variable

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 12, 2024, 5:17pm UTC](https://forums.unrealengine.com/t/which-is-better-create-4-class-or-1-class-for-4-similar-actor/2213032/5 "2024-12-12T17:17:45Z")

</div>

> [@CodeWizard1](#):
>
> One Actor.

?

---

<div class="post-metadata">

**Author:** ![Sor9ryINoob](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sor9ryINoob](https://forums.unrealengine.com/u/Sor9ryINoob)\
**Post date:** [December 12, 2024, 6:16pm UTC](https://forums.unrealengine.com/t/which-is-better-create-4-class-or-1-class-for-4-similar-actor/2213032/6 "2024-12-12T18:16:45Z")

</div>

thx all, i just notice i can rename the actor after pulling them to the world.

Another question, the actor’s new location is provided by my controlling pawn. For example, i press 1, and then do a trace channel, then actorA will change to the hit result point. How can I move the actor by it’s name when only create 1 class

---

<div class="post-metadata">

**Author:** ![Sor9ryINoob](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sor9ryINoob](https://forums.unrealengine.com/u/Sor9ryINoob)\
**Post date:** [December 12, 2024, 6:32pm UTC](https://forums.unrealengine.com/t/which-is-better-create-4-class-or-1-class-for-4-similar-actor/2213032/7 "2024-12-12T18:32:47Z")

</div>

oh, i can just compare the array with name after get all actors since i have their names already. Thanks all !!

---

<div class="post-metadata">

**Author:** ![doctorpepperdan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@doctorpepperdan](https://forums.unrealengine.com/u/doctorpepperdan)\
**Post date:** [December 12, 2024, 8:22pm UTC](https://forums.unrealengine.com/t/which-is-better-create-4-class-or-1-class-for-4-similar-actor/2213032/8 "2024-12-12T20:22:39Z")

</div>

One class, I do this for different types of enemies(base,ranged,heavy, ect …) one class represents many varieties of enemies that have their mesh, level, and other attributes get set on spawn based off of data tables

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [January 11, 2025, 8:23pm UTC](https://forums.unrealengine.com/t/which-is-better-create-4-class-or-1-class-for-4-similar-actor/2213032/9 "2025-01-11T20:23:16Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
