# C++ plugin editor use only (Lock export)

**URL:** <https://forums.unrealengine.com/t/c-plugin-editor-use-only-lock-export/446246>\
**Category:** Plugins\
**Tags:** security, unreal-engine, editor, Plugins, question, CPP\
**Created:** [March 29, 2019, 6:25pm UTC](https://forums.unrealengine.com/t/c-plugin-editor-use-only-lock-export/446246 "2019-03-29T18:25:44Z")\
**Posts on this page:** 4\
**Page:** 1

<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 29, 2019, 6:25pm UTC](https://forums.unrealengine.com/t/c-plugin-editor-use-only-lock-export/446246/1 "2019-03-29T18:25:44Z")

</div>

Hello! I’m looking for a good way to create a compiled demo plugin you can test inside the editor but i need to disable the “build project” option or generate an error while it’s exporting the project to block any ability to create a standalone product.

Could using “#if WITH\_EDITOR” be a valid option?

> **[\#if WITH\_EDITOR only removing code from .h, not .cpp](https://forums.unrealengine.com/questions/770145/if-with-editor-only-removing-code-from-h-not-cpp.html)**
>
> Using #if WITH\_EDITOR I have declared a property, that when packaged without the editor, correctly removes itself from the code. However references to that property (also wrapped in #if WITH\_EDITOR) get packaged anyway; resulting in compile errors. ...

Thank you!

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [March 29, 2019, 8:37pm UTC](https://forums.unrealengine.com/t/c-plugin-editor-use-only-lock-export/446246/2 "2019-03-29T20:37:26Z")

</div>

Just don’t include binaries (lib files intermidiate/build directory) of Development non-editor (lib file in UE4 not UE4Editor) and Shipping build of your plugin. And don’t include source (header files at most if you want your plugin to be C++ enabled), if you include it anyone can build your plugin and remove any form of protection.

Module build version need to match with the rest of the engine, otherwise it will fail at linking, so editor module won’t work on standalone engine build

If you really worried you can also crash the engine on module load if WITH\_EDITOR is false

---

<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 29, 2019, 9:07pm UTC](https://forums.unrealengine.com/t/c-plugin-editor-use-only-lock-export/446246/3 "2019-03-29T21:07:28Z")

</div>

I will try removing those files later, thank you very much! Awesome answer!

---

<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:** [April 5, 2019, 11:59pm UTC](https://forums.unrealengine.com/t/c-plugin-editor-use-only-lock-export/446246/4 "2019-04-05T23:59:02Z")

</div>

It works, thank you very much!
