Download

Sharing code between multiple projects

How share and use same C++ code between multiple, not related to each other, projects?
What I mean by that is a way to make a code behave like a static library, like in “default” C++, so it could be possible to



#include "CoreMinimal.h"
#include "path/to/MyCustomLibrary.h"

UCLASS()
and so on


AFAIK, there are no way to actually compile UE related code into simple library and then just copypaste it to different projects and use #include. So how do it with “dummy” project?

Or its impossible and the only way is to create new UE class in new project and copypaste whole code directly into it from other project?

You could create plugins and copy that over to other projects.

Yes use Plugins. This is how I do it for my current project. All you do is put a folder Plugins in root directory of project.
-Inventory Plugin
-Character Plugin
-Camera Plugin (So each actor does not need its own camera and there is only one that can attached to whatever pawn is controlled).
-Custom Input System Plugin
-Dialogue Plugin
-Menu System Plugin
-AGameExample Plugin (built using above).

Our team does not actually use project content folder.
Each team member has his own plugin and than were going to merge them into one master plugin for the as the main game plugin. I just have my AGameExample since I am the programmer and and I provided example how to use them all.

Plugins :slight_smile: