How to Access Blueprint Custom Class in C++ Code

Hi everyone,

I have a project where I created a Blueprint Actor Component, and now I want to access it from a C++ Actor Class. I tried to use FindComponentByClass function but my BP class doesn’t appear there. How can I manage this ? I looked online for solution but I found mainly people trying to access to alredy exisiting BP class or C++ custom classes.

Thank you

As far as I am aware I don’t think you can create BP actor classes in editor and access them in C++, but you can do that inversely from C++/ visual studio and access them via blueprint or C++. Just as long as the access specifiers are there and they are blueprint read writable.

If you want to add the actor with C++ functionality you can add it under File> New C++ Class… Adding with just blueprints isn’t generating the .h and .cpp files to do anything with in your code editor.

I know you can view native pure functions by double clicking them in blueprint and it’ll take you to visual studio.

It’s possible to query that info through type reflection in C++, but to do that you have to understand how the Blueprint’s Virtual Machine works…

Learning how it works might take a while.

One way I can see is to create a C++ class derived from UActorComponent, and set it to be the Parent class of your blueprint actor component. It changes nothing in the functionality, but now you can declare any function with UFUNCTION(BlueprintImplementableEvent) specifier, and use it in your ActorComponent to call anything you like.

1 Like

Thank you everyone for your replies.

@Humanasset I see, in that case I will go with @Tuerer solution, create a C++ Actor Component Class and make the blueprint Inherit from it so that I don’t need to rewrite all my BP in C++
@BrUnO_XaVIeR will dive in that at some point but not at the moment I think, but thanks for the tip

Thank you for your suggestion guys !

1 Like