Download

Create new blueprints (assets) from class

Hi,
I want to create new blueprints (assets) from class. I have looked for some methods, but they all require C++ or Python. Can I do this only with blueprints? The closest I found was the Create Asset node, but I could not successfully create a blueprint asset.

1 Like

Hello, are you trying to do this at runtime (in-game)? Or, if this is in the editor, are you simply trying to make a subclass of a class, or do you need to automate it?

1 Like

Yes, I want to run it automatically in the editor.I want to use Editor Utility Widget to achieve it.

Maybe you can right click the parent blueprint and select “Create Child Blueprint Class”

Yes, I can do this manually. But now I want to create tools to do this automatically.

I think my question becomes how to set the Factory in the blueprint. If I use Python, I can use factory.set_editor_property() to set it, but when I use the Create Asset node, I don’t know how to set it.
20210803185223

You leave it blank; it makes the correct factory automatically. Though, I’d recommend duplicating a dummy asset instead because CreateAsset sometimes makes things that can’t be used.

Oh, sorry, I didn’t explain clearly, I want to specify the parent class when I create it. When I use python, I can call factory.set_editor_property(“ParentClass”, unreal.Object) to do this, but I don’t know how to set it in the blueprint.

So, apparently you create an asset of the factory you need first, set the parent class in the factory, then create the asset using the factory. The problem is, since the factory isn’t a BlueprintType, you can’t set the variable in blueprints.

A quick fix is to just keep the factory saved as an asset, open it using the “OpenAsset” node whenever you need to set the class, and create the asset using the factory. Or, you can make a function library in C++ that takes the factory asset as input and sets the variable in the factory.

1 Like

Thank you, I finally did it. :grinning:

1 Like