# Editor only UFUNCTIONS and UPROPERTIES

**URL:** <https://forums.unrealengine.com/t/editor-only-ufunctions-and-uproperties/383419>\
**Category:** Platform & Builds\
**Tags:** UProperty, ufunction, unreal-engine, Packaging, question\
**Created:** [January 30, 2017, 5:52pm UTC](https://forums.unrealengine.com/t/editor-only-ufunctions-and-uproperties/383419 "2017-01-30T17:52:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ungalyant](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ungalyant](https://forums.unrealengine.com/u/Ungalyant)\
**Post date:** [January 30, 2017, 5:52pm UTC](https://forums.unrealengine.com/t/editor-only-ufunctions-and-uproperties/383419/1 "2017-01-30T17:52:13Z")

</div>

Hey guys, so something I’m struggling with at the moment, in relation to my last question (which I’m in the process of trying to answer through this question):

> **[Packaging error: Non-editor build cannot depend on non-redistributable modules](https://forums.unrealengine.com/questions/554673/compile-error-non-editor-build-cannot-depend-on-no.html)**
>
> This is a question that I know has come up before. I’ve looked at some existing answers: I’ve attempted to implement the fixes they recommend, and I’m trying to package our project for windows 64-bit and still getting this error. My Build.cs...

Is there a way to have UPROPERTY() variables that exist for editor use only?

I can simply surround a variable declaration with #if WITH\_EDITOR pragmas, but it seems if this variable is a UPROPERTY() the engine looks for it at runtime even in a non-editor build, I assume this is because of something in the generated class. Blueprint editable editor only variables are a nice solution for us to simply make editing information easier without bloating the actual build. Is there any way to actually implement something like this?

Cheers for any thoughts you guys have!

---

<div class="post-metadata">

**Author:** ![gu111aume](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gu111aume](https://forums.unrealengine.com/u/gu111aume)\
**Post date:** [May 18, 2017, 8:19pm UTC](https://forums.unrealengine.com/t/editor-only-ufunctions-and-uproperties/383419/2 "2017-05-18T20:19:46Z")

</div>

Any news on this? Any replacement for the editoronly keyword in UE3?

---

<div class="post-metadata">

**Author:** ![Ungalyant](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ungalyant](https://forums.unrealengine.com/u/Ungalyant)\
**Post date:** [October 5, 2017, 10:10am UTC](https://forums.unrealengine.com/t/editor-only-ufunctions-and-uproperties/383419/3 "2017-10-05T10:10:15Z")

</div>

The work around (and it is quite disgusting) that I’ve found is this:

When you make a UPROPERTY automatic code is generated in the  
Intermediate\Build\Win64\ **YourProjectName** \Inc\ **YourProjectName** \ **YourBlueprint**.gen.cpp

This generated code doesn’t seem to pay attention to the #WITH\_EDITOR pragma, so you now have a file that is referencing for build a variable that as far as the actual script is concerned, doesn’t exist. The horrible hack around I found is that you can just go into that .gen.cpp file in …\Inc… and surround your variables with the same #WITH\_EDITOR pragmas, this let me build fine, but I have no idea the knock on effects it might have. It also means that every time that .gen.cpp file gets deleted/regenerated, you will have to go back and re-add the #WITH\_EDITOR pragmas.

---

<div class="post-metadata">

**Author:** ![\_NL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@\_NL](https://forums.unrealengine.com/u/_NL)\
**Post date:** [May 19, 2021, 10:10pm UTC](https://forums.unrealengine.com/t/editor-only-ufunctions-and-uproperties/383419/4 "2021-05-19T22:10:23Z")

</div>

For anybody having this issue, the solution is in [that thread](https://answers.unrealengine.com/questions/946673/if-with-editor-protection-creates-error-while-pack.html):

> Data members within UHT parsed types need to be compiled out with `#if WITH_EDITORONLY_DATA` rather than `#if WITH_EDITOR` (which you _do_ use for functions).
