# Is it possible to make a plugin that can be used in Editor and also get packaged as runtime?

**URL:** <https://forums.unrealengine.com/t/is-it-possible-to-make-a-plugin-that-can-be-used-in-editor-and-also-get-packaged-as-runtime/500017>\
**Category:** Plugins\
**Tags:** unreal-engine, UE4-26, UE4, question\
**Created:** [February 19, 2022, 8:19pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-make-a-plugin-that-can-be-used-in-editor-and-also-get-packaged-as-runtime/500017 "2022-02-19T20:19:26Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aconex](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/aconex/32/88713_2.png) [@Aconex](https://forums.unrealengine.com/u/Aconex)\
**Post date:** [February 19, 2022, 8:19pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-make-a-plugin-that-can-be-used-in-editor-and-also-get-packaged-as-runtime/500017/1 "2022-02-19T20:19:26Z")

</div>

Hey,

so me and my project group are working on a plugin for an university project, which is operable through the Editor’s toolbar.

All of that works so far, but we have some C++ Content in the plugin that needs to be used at runtime.  
The problem is, that an editor plugin does not seem to be able to be packaged.  
In the packaged project, there is no plugin folder and the C+±Classes seem to be gone, while the Blueprints located inside the plugin’s content folder are functioning.  
Changing the type in the .uplugin to Runtime produces an error, since UnrealEd can not be instantiated for non-editor targets.

This is the part that produces errors while packaging in a test project:

> UATHelper: Packaging (Windows (64-bit)): ERROR: Unable to instantiate module ‘UnrealEd’: Unable to instantiate UnrealEd module for non-editor targets.  
> UATHelper: Packaging (Windows (64-bit)): (referenced via Target → VIR\_ENVIRONMENT.Build.cs)  
> PackagingResults: Error: Unable to instantiate module ‘UnrealEd’: Unable to instantiate UnrealEd module for non-editor targets.  
> UATHelper: Packaging (Windows (64-bit)): Took 3,8490541s to run UnrealBuildTool.exe, ExitCode=6  
> UATHelper: Packaging (Windows (64-bit)): UnrealBuildTool failed. See log for more details. (C:\Users\spata\AppData\Roaming\Unreal Engine\AutomationTool\Logs\F+EpicGames+UE\_4.26\UBT-ue4\_vir\_env-Win64-Development.txt)  
> UATHelper: Packaging (Windows (64-bit)): AutomationTool exiting with ExitCode=6 (6)  
> UATHelper: Packaging (Windows (64-bit)): BUILD FAILED  
> PackagingResults: Error: Unknown Error

Is there any way to make it work for both the editor and runtime?  
Or do we have to split the plugin into two separate ones, one with the editor functionality and another one with the other content?

Best regards

---

<div class="post-metadata">

**Author:** ![The\_Regurgitator](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/the_regurgitator/32/710746_2.png) [@The\_Regurgitator](https://forums.unrealengine.com/u/The_Regurgitator)\
**Post date:** [February 22, 2022, 12:43pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-make-a-plugin-that-can-be-used-in-editor-and-also-get-packaged-as-runtime/500017/2 "2022-02-22T12:43:05Z")

</div>

If you have a dependency on Editor-Only modules, you will need to either split out your plugin into Runtime and Editor components, or edit the .uplugin/.build.cs to exclude the Editor stuff when not building in Editor configuration

---

<div class="post-metadata">

**Author:** ![The\_Regurgitator](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/the_regurgitator/32/710746_2.png) [@The\_Regurgitator](https://forums.unrealengine.com/u/The_Regurgitator)\
**Post date:** [February 22, 2022, 12:44pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-make-a-plugin-that-can-be-used-in-editor-and-also-get-packaged-as-runtime/500017/3 "2022-02-22T12:44:10Z")

</div>

The Editor GUI does not exist in a packaged build.

---

<div class="post-metadata">

**Author:** ![Kafumanto](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kafumanto/32/1194651_2.png) [@Kafumanto](https://forums.unrealengine.com/u/Kafumanto)\
**Post date:** [February 25, 2022, 3:58pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-make-a-plugin-that-can-be-used-in-editor-and-also-get-packaged-as-runtime/500017/4 "2022-02-25T15:58:16Z")

</div>

Plugins can have multiple _modules_, in your case I suggest to have:

- a “runtime” module (that can be used both inside the Editor and that will be packaged in the final application build);
- an “editor” module (that will have access to the “runtime” module and will be able to integrate with the editor).

This is the generic organisation for the above scenario:

```auto
MyPlugin\
    MyPlugin.uplugin
    Source\
        MyPlugin\ (usually this is the runtime module)
            MyPlugin.Build.cs
        MyPluginEditor\ (usually this is the editor module)
            MyPluginEditor.Build.cs

```

In the `MyPlugin.uplugin` file you must list both the modules, each one with the correct `Type` property:

```auto
    "Modules": [
        {
            "Name": "MyPlugin",
            "Type": "Runtime",
            "LoadingPhase": "Default"
        },
        {
            "Name": "MyPluginEditor",
            "Type": "Editor",
            "LoadingPhase": "Default"
        }
    ]

```

In the file `MyPluginEditor.Build.cs` you must add the dependency to your runtime module (_MyPlugin_):

```auto
PrivateDependencyModuleNames.AddRange(new string[] {
  "MyPlugin"
});

```

If instead of the above setup you want to use a single module, then you can explicitly check for Editor builds in your `Build.cs` files:

```auto
if (Target.bBuildEditor)
{
    PrivateDependencyModuleNames.Add("UnrealEd");
}

```

And use `#if WITH_EDITOR`/`#if WITH_EDITORONLY_DATA` and similar to wrap your editor code.

---

<div class="post-metadata">

**Author:** ![Doudinvillier](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Doudinvillier](https://forums.unrealengine.com/u/Doudinvillier)\
**Post date:** [March 6, 2023, 7:28pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-make-a-plugin-that-can-be-used-in-editor-and-also-get-packaged-as-runtime/500017/5 "2023-03-06T19:28:54Z")

</div>

Hi!  
Like stated above, I added a second module to my plugin but I cannot import the module into the other…  
I keep getting unresolved external symbol errors when im loading the module! I looked for hours and cant find the answer why… Am i missing something? ( I did exactly what was specified above)

---

<div class="post-metadata">

**Author:** ![Klian](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/klian/32/1207571_2.png) [@Klian](https://forums.unrealengine.com/u/Klian)\
**Post date:** [March 6, 2023, 8:23pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-make-a-plugin-that-can-be-used-in-editor-and-also-get-packaged-as-runtime/500017/6 "2023-03-06T20:23:06Z")

</div>

> [@Kafumanto](#):
>
> In the file `MyPluginEditor.Build.cs` you must add the dependency to your runtime module (_MyPlugin_)

Hello @Doudinvillier, did you add your new module to this list?

---

<div class="post-metadata">

**Author:** ![Doudinvillier](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Doudinvillier](https://forums.unrealengine.com/u/Doudinvillier)\
**Post date:** [March 7, 2023, 8:47am UTC](https://forums.unrealengine.com/t/is-it-possible-to-make-a-plugin-that-can-be-used-in-editor-and-also-get-packaged-as-runtime/500017/7 "2023-03-07T08:47:58Z")

</div>

hi [Klian](https://forums.unrealengine.com/u/Klian)

Yes I did, it allowed me to include the .h file. But I get this error when instantiating the class…

---

<div class="post-metadata">

**Author:** ![Doudinvillier](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Doudinvillier](https://forums.unrealengine.com/u/Doudinvillier)\
**Post date:** [March 7, 2023, 12:58pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-make-a-plugin-that-can-be-used-in-editor-and-also-get-packaged-as-runtime/500017/8 "2023-03-07T12:58:24Z")

</div>

it’s so weird. I started over, created my plugin from scratch, added a second module and it stills doesnt work. Im using UE5.1.  
It is because im creating my 2nd module by creating another plugin and copying the files as a 2nd module to my plugin?

maybe something that has to do with the path of my module files not specified somewhere after i move them?

[Kafumanto](https://forums.unrealengine.com/u/Kafumanto) would you have any input? thanks so much for the help, it’s driving me crazy

---

<div class="post-metadata">

**Author:** ![Packetdancer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/packetdancer/32/462643_2.png) [@Packetdancer](https://forums.unrealengine.com/u/Packetdancer)\
**Post date:** [March 27, 2023, 8:23pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-make-a-plugin-that-can-be-used-in-editor-and-also-get-packaged-as-runtime/500017/9 "2023-03-27T20:23:51Z")

</div>

Is it possible for you to share the plugin, so folks can take a look and see what might be going wrong?

It does seem likely to me that it’s because you’re creating an entire second plugin and trying to copy things in, yes.
