How to manage Plugin Code?

Hey guys.

I have a little issue here :slight_smile:
Hope somebody can help me

I wrote a custom Editor Plugin (custom BlueprintEditor which generates a RuntimeAsset)
I only have one Module at the moment.

I saw in “Extending the Editor” Tutorial that he made 2 Modules
A Runtime Module and
a Editor Module

Should I also implement it that way?
I think keeping it my way could result in packaging problems

You have to create at least two modules because the runtime module will be inculded in shipping build, but editor module will be excluded from the shipping. If you write plugin only for editor you can use only editor module.
Maybe you’ll need more than one runtime or editor modules - some features requires different loading stages to hook correctly.

Editor APIs are not avable when you build non-editor build of the game, you will get errors during packaging if it hit any editor API. Thats why you need to diffrent modules one marked as editor module so engine will know to not include it in game build. But if editor part is small or part of existing class which is hard to seperate, you can avoid making two diffrent modules by conditioning the code like this:

#if WITH_EDITOR

//editor code here

#endif

Code in that block will build only on editor build. But if it’s something bigger, like stuff with own classes, it better and cleaner to make separate module.

This is not just plugins, you need to do this is game and if you edit engine code in anyway. Modules are same thing regardless where they are, plugins, game projects are just different way of managing and distributing them.

Thx for your answer :slight_smile:
It’s a custom Blueprint Editor so the Editor stuff covers most of the Source Code. For Runtime I only use a Component and a few UObjects.
Problem:
I have a BlueprintGeneratedClass, which is also known to a Runtime Asset.
Should this be included into the Runtime Module then?

I think 2 modules should be enough. I only need one BlueprintEditor and a Runtime Asset representation of the Blueprint.

Thx for your answer :slight_smile:

If you have some runtime UCLASS-es you need a runtime module.