How can I create a generic ActorComponent?

Hello,

I created a new CPP project where I made my own CPP component. Let’s call it customActorComponent.

I would like to re-use this component in different, new Blueprint (non-CPP) projects.This is, I would like to create a new BP project, create a BP actor, and add customActorComponent from the blueprint.

What’s the procedure to do this?

Regards
,
Paco

CPP project produces .dll file of your game. That’s where the code for component lives, but it can’t be transferred to other non-cpp project. Non-cpp projects use prebuilt UE4 dlls and .exe’s so the game won’t know about your dll

There is no other way than changing the target project to cpp and adding copying your file.

So short from building the UE4 engine with my new actor component I’m out of options? Exporting the component like a uasset would be nice.

Thank you for your response!

Yes. The compiled C++ code for your component lives in the original project DLL.

Uassets only contain info about delta of properties (from c++ defaults), bp graphs, and pointer to C++ class that is the parent.

I’m still trying to figure this out.
The project where I created my actorComponent (project a) generated 3 dlls:
./Binaries/Win64/UE4Editor-a.dll
./Intermediate/Build/BuildRules/aModuleRules.dll
./Intermediate/Build/BuildRules/RocketUE4ModuleRules.dll

I created a different cpp project (project b) and built it. Where do I place the project a dll files so I can add my actorComponent to project b?

I really appreciate your help.

You don’t.

It’s not supported (nor probably possible) to exchange dll’s between projects.

Copy your code from one project to another.

Otherwise, you may try to create a new Engine-level module or plugin out of the code shared by the projects:

Thank you for clarifying!