# How on earth do I get a 'factory' to create a class or subclass?

**URL:** <https://forums.unrealengine.com/t/how-on-earth-do-i-get-a-factory-to-create-a-class-or-subclass/541403>\
**Category:** Editor Scripting\
**Tags:** Editor-Scripting, unreal-engine, UE5-0, question\
**Created:** [April 27, 2022, 8:39pm UTC](https://forums.unrealengine.com/t/how-on-earth-do-i-get-a-factory-to-create-a-class-or-subclass/541403 "2022-04-27T20:39:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Street\_Mage](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/street_mage/32/568933_2.png) [@Street\_Mage](https://forums.unrealengine.com/u/Street_Mage)\
**Post date:** [April 27, 2022, 8:39pm UTC](https://forums.unrealengine.com/t/how-on-earth-do-i-get-a-factory-to-create-a-class-or-subclass/541403/1 "2022-04-27T20:39:18Z")

</div>

I want to do this with python or blueprints or both. With editor tools I can only create a duplicate but I’m not sure where or how to get a factory just to make classes.

---

<div class="post-metadata">

**Author:** ![jwatte](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jwatte/32/744941_2.png) [@jwatte](https://forums.unrealengine.com/u/jwatte)\
**Post date:** [April 27, 2022, 10:49pm UTC](https://forums.unrealengine.com/t/how-on-earth-do-i-get-a-factory-to-create-a-class-or-subclass/541403/2 "2022-04-27T22:49:06Z")

</div>

First, you don’t “make classes,” because classes are code. You write the code.

Second, why do you need a “factory”? What is this “factory” supposed to do, that a function like “Spawn Actor From Class” won’t already do for you?

Are you talking about “spawner actors”? Those are actors of some class that you make, that, at runtime, on some timer, or at some event, will call “Spawn Actor From Class” to create a new instance of some class/blueprint, in the world.

---

<div class="post-metadata">

**Author:** ![Street\_Mage](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/street_mage/32/568933_2.png) [@Street\_Mage](https://forums.unrealengine.com/u/Street_Mage)\
**Post date:** [April 28, 2022, 12:12pm UTC](https://forums.unrealengine.com/t/how-on-earth-do-i-get-a-factory-to-create-a-class-or-subclass/541403/3 "2022-04-28T12:12:42Z")

</div>

You absolutely do ‘make classes’. As in create classes. What do you not understand? Create classes the same way you create them by right clicking in the content browser and selecting create blueprint class, or interface, or whatever you want. There’s even a create asset node you can access with asset tools. However, it has an input pin for a factory.

---

<div class="post-metadata">

**Author:** ![jwatte](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jwatte/32/744941_2.png) [@jwatte](https://forums.unrealengine.com/u/jwatte)\
**Post date:** [April 28, 2022, 2:19pm UTC](https://forums.unrealengine.com/t/how-on-earth-do-i-get-a-factory-to-create-a-class-or-subclass/541403/4 "2022-04-28T14:19:39Z")

</div>

Gotcha – that additional context is very helpful to illustrate what you actually mean!

---

<div class="post-metadata">

**Author:** ![BioeJD](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BioeJD](https://forums.unrealengine.com/u/BioeJD)\
**Post date:** [December 5, 2022, 2:42am UTC](https://forums.unrealengine.com/t/how-on-earth-do-i-get-a-factory-to-create-a-class-or-subclass/541403/7 "2022-12-05T02:42:39Z")

</div>

You showed up to ridicule his very valid question because you didn’t understand it, but once he helped you understand, you disappear?

---

<div class="post-metadata">

**Author:** ![jwatte](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jwatte/32/744941_2.png) [@jwatte](https://forums.unrealengine.com/u/jwatte)\
**Post date:** [December 5, 2022, 3:27am UTC](https://forums.unrealengine.com/t/how-on-earth-do-i-get-a-factory-to-create-a-class-or-subclass/541403/8 "2022-12-05T03:27:12Z")

</div>

Because I didn’t have an answer, once I understood the question.  
If you believe that asking clarifying questions is “ridicule” then I don’t know what to say.

---

<div class="post-metadata">

**Author:** ![jwatte](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jwatte/32/744941_2.png) [@jwatte](https://forums.unrealengine.com/u/jwatte)\
**Post date:** [December 5, 2022, 3:44am UTC](https://forums.unrealengine.com/t/how-on-earth-do-i-get-a-factory-to-create-a-class-or-subclass/541403/9 "2022-12-05T03:44:01Z")

</div>

So, reading the code: Asset factories are not implementable or accessible through Blueprints (or Python, which largely has access to a similar API)  
You will need C++ to do this.

Note that “classes” as used in the OP are generally referred to in the editor as “blueprints” or “bluepring classes” and come in a few variants – e g, an “animation blueprint” is different from an “actor blueprint” and is different from a “control rig blueprint” for example, and they have different factories.

The code does not expose the `UBlueprintFactory` base class, so you’ll want to wrap any such use you need into a C++ code path:

```auto
UCLASS(hidecategories=Object, collapsecategories)
class UNREALED_API UBlueprintFactory : public UFactory
{

```

---

<div class="post-metadata">

**Author:** ![AyanMiru](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ayanmiru/32/1194638_2.png) [@AyanMiru](https://forums.unrealengine.com/u/AyanMiru)\
**Post date:** [December 5, 2022, 8:09am UTC](https://forums.unrealengine.com/t/how-on-earth-do-i-get-a-factory-to-create-a-class-or-subclass/541403/10 "2022-12-05T08:09:10Z")

</div>

Short answer:  
There are variety of factory classes accessible trough Python (and most likely in BP):  
[https://docs.unrealengine.com/5.0/en-US/PythonAPI/search.html?q=factory](https://docs.unrealengine.com/5.0/en-US/PythonAPI/search.html?q=factory)

Simple snippet to create a ControlRig asset (you need to have ControlRig and EditorUtility plugins enabled):

```auto
factory = unreal.ControlRigBlueprintFactory
blueprint = factory.create_new_control_rig_asset(desired_package_path = ASSET_PATH)

```

Slightly longer answer:  
Factory is a programming pattern, it’s a class that allows you to create other classes based on inputs. You don’t need to implement factory, but you need to get access to one in order to use it.

In Unreal there is the Factory class and child classes of it for the most (all?) asset types you can use in ContentBrowser. Most of them partially exposed for BP and Python, but not everything. Some of functionality can be accessed through helper class AssetTools. If you using factories directly, it can be worth to check specific implementation of it. Not all can be usable trough BP or Py, some will require you to prebuild a Task class with parameters so factory knows what you want and others will only import or may have other quirks.

Here is an example I could find that is related:

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/d/c/1dc43336961a997cc2f3ee22f7ecfe49d122ce0e.jpeg "UE 4.22 - How To Create Generic Assets With Python") ](https://www.youtube.com/watch?v=1eWt1AOdCg0)

Hope this helps 🙂
