C++ actor in blueprint project

Hi, I newbie in c++ and i need some help
I created c++ actor and I want to use this actor in other project but this project is blueprint type.

I suspect that there need to use plugin, but if I create plugin, will put my c++ actor there and just move this plugin folder into my other blueprint project i won’t see my actor

How can I implement this?

Hi @Artdyx!

Actually, it’s not necessary to create a plugin for that. Just create a C++ file and set it as Blueprintable, BlueprintType on the specifiers of the UCLASS(). Also there is another post with the same question that can help you further here

Link to the docs :slight_smile: Class Specifiers | Unreal Engine 4.27 Documentation

The project changes to c++ project if you click File->New C++ Class…
You can then just delete the newly created files, and copy in your old files

A plugin should also work, but plugin-content are probably hidden in the content-browser.
Clicking ViewOptions->ShowPluginContent in the content-browser might help

But I don’t want to convert all my blueprint project to c++

I want to use my c++ actor to another projects regardless of the type project (how on screenshot in this link)

Seems like the link wasn’t posted, so not sure how it looks there.
But it then should work in a plugin as i wrote.
Creating a child-blueprint of it can also be an easy way to get it to show up in the content-browser.

On the content browser (on the source section, C++ Classes or wherever you want really) press right click and create a new C++ Class.
image

Select Actor

Then select where you want to create it, and its name (it can be changed later)

Then it should open your text editor (visual studio, rider, or whatever you have) on the just created class. Code it as you want.

image

In the header file you can add specifiers to the UCLASS(), for this example you will probably need BlueprintType and Blueprintable.

image

Compile it and now you can create new blueprint classes that inherit from AMyActor (or the actor you created on c++), you can also assign variables in BP as that class, for instance another class that has a variable of type AMyActor can now be used.

This doesn’t convert your project from Blueprint to c++, it just creates a class created on c++ that can be used alongside blueprint classes. Notice that blueprints are assets while cpp files are source, this means that blueprints can use c++ classes without any problems, but the same CAN NOT be said otherwise, using/referencing a bp from a cpp file is something I’m not sure is possible, and if it is, it will be a source of many headaches.

Hope this helps!

1 Like

Yeah it is really helpful. Really big Thanks!

After that can I move this actor to another blueprint’s project and it will work?

My purpose - create c++ actor in first project by use it in second project
Unreal Project Browser_220916171901

Not right away, you would need to make sure the dependencies are okay (the #includes) and compile it again in the new project. It should work after that.

Anyway thanks for help
But solution for me it is build plugin by this links

and after that I can use this actor anywere

Actually Blueprintable is inherited by subclasses, and AActor is Blueprintable, so this isn’t be necessary. The same may also go for BlueprintType, I have never put either specifier on my actor subclasses and haven’t run into any problems as yet accessing properties or functions.

1 Like

Had no idea! Thanks!