Download

C++ Class included in a plugin

Hello!

Not sure if this is the right area to be asking this question so let me know if I need to move it elsewhere.

I’ve written a C++ class that I’d like to include in a plugin, but I’ve never created a plugin before so I don’t really know where to start. I figured out how to make a blank plugin, set up the meta files and all that, but as for adding content, classes etc, I’m not sure.

Is there and easy way for me to simply just include the class in the plugin?

I’m also utilizing and existing (free) marketplace plugin. Is there a way for me to specify this in the Build.cs dependencies or similar?

Thanks in advance!
Steve.

Adding Code/Content to a plugin is the same as everywhere else in the engine. Just toss it in the appropriate directory ( Engine/Plugins/MyPlugin/Source/Public(or Private)/MyCodeFile.cpp ). Just make sure you export the class if you want people to have access to it (i.e. class MYPLUGIN_API MyCustomClass).

Take a look at Paper2D or any other plugin in the engine if you want to see how others are doing it.

File - > Add C++ Class -> Change the dropdown bar from project name to plugin name -> choose public or private -> profit.

Also if you want to learn how to do other simple plugins or not build it yourself, in the Edit - > Plugins -> PluginWindow there is a button -> New Plugin