# Avoid UObject factory for blueprint?

**URL:** <https://forums.unrealengine.com/t/avoid-uobject-factory-for-blueprint/300024>\
**Category:** Blueprint\
**Tags:** unreal-engine, CPP, Blueprint, question\
**Created:** [November 27, 2014, 6:14pm UTC](https://forums.unrealengine.com/t/avoid-uobject-factory-for-blueprint/300024 "2014-11-27T18:14:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_2df21e76](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2df21e76](https://forums.unrealengine.com/u/anonymous_user_2df21e76)\
**Post date:** [November 27, 2014, 6:14pm UTC](https://forums.unrealengine.com/t/avoid-uobject-factory-for-blueprint/300024/1 "2014-11-27T18:14:36Z")

</div>

Hello,

As it appears, UObjects and derived types are manipulated only through pointers in blueprint, however when creating a variable, it only really creates a null pointer.

Therefore, if you want to create one of your objects, it seems like the only solution is to implement a factory, much like what is described in the following wiki page :

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...

While this works fine, it is a bit tedious to use and not necessarily obvious for a non-programmer doing blueprint scripting. It also seems logical that, since unreal has introspection and reflection of the derived C++ UObject types, it should be able to expose allocating and creating a UObject without any manual work from the programmer.

So is there another way than creating and exposing my factories ? Is it possible to locally instanciate an object and set its values as a variable or component of my blueprint with available tools, or do UObject always have to be dynamically instanciated in the event graph with factories ?

---

<div class="post-metadata">

**Author:** ![theknoppix](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@theknoppix](https://forums.unrealengine.com/u/theknoppix)\
**Post date:** [March 19, 2015, 3:32pm UTC](https://forums.unrealengine.com/t/avoid-uobject-factory-for-blueprint/300024/2 "2015-03-19T15:32:57Z")

</div>

I was looking for a way to create objects type of classes derived from uobject on runtime too and just found this code snippet to add that functionality. I’m really curious about the side effects of it because epic doesn’t give this feature as default on blueprint. Can someone explain why please?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2df21e76](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2df21e76](https://forums.unrealengine.com/u/anonymous_user_2df21e76)\
**Post date:** [March 19, 2015, 3:35pm UTC](https://forums.unrealengine.com/t/avoid-uobject-factory-for-blueprint/300024/3 "2015-03-19T15:35:38Z")

</div>

Agreed, I can’t imagine I’m the only one wondering about this, but never really got a reply. It seems like we generate enough reflexion/introspection code to be able to construct our UObjects without having to call our own code just to call “new”.

There must be some kind of system that I’m missing, it just seems like the first thing one would look for.

---

<div class="post-metadata">

**Author:** ![theknoppix](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@theknoppix](https://forums.unrealengine.com/u/theknoppix)\
**Post date:** [March 19, 2015, 3:45pm UTC](https://forums.unrealengine.com/t/avoid-uobject-factory-for-blueprint/300024/4 "2015-03-19T15:45:33Z")

</div>

I thought i miss something at first but after researching and trying lots of thing, i realized this is the only way to create it. Why would epic block something like this? If it’s because garbage collection, what we should be careful about while using this?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2df21e76](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2df21e76](https://forums.unrealengine.com/u/anonymous_user_2df21e76)\
**Post date:** [March 19, 2015, 4:01pm UTC](https://forums.unrealengine.com/t/avoid-uobject-factory-for-blueprint/300024/5 "2015-03-19T16:01:55Z")

</div>

I don’t think it presents any danger, other than a mild annoyance. But it’s also counter-intuitive in the hand of an artist editing a blueprint, when they create a variable of your UObject type, they’d expect to be manipulating an instance of that object, not a (potentially null) pointer.

Would love an official answer on this 🙂

---

<div class="post-metadata">

**Author:** ![theknoppix](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@theknoppix](https://forums.unrealengine.com/u/theknoppix)\
**Post date:** [March 29, 2015, 9:39am UTC](https://forums.unrealengine.com/t/avoid-uobject-factory-for-blueprint/300024/6 "2015-03-29T09:39:54Z")

</div>

Still really want to hear the reason from Epic, why this is not default feature for blueprints?
