Why "#if WITH_EDITOR" in some souce code?

I wan’'t to capture scene movie with ue4,I find the moviescenecapture and AVIWriter can do it,I change the code let it can capture movie in runtime,but it not work when I package project,I find some code “#if WITH_EDITOR” and other code make this problem,my question is what is other code?

I think that the function of this macro was created so as not to execute what is not necessary for the game when the package is made.

It’s preprocessing condition, if parameter given to #if is flase or undefined then this portion of code to #endif won’t be compiled, it will behave like it does not exist. WITH_EDITOR is true (or rether defined) if you build module for editor build of the engine. It is required if editor APIs are used that are not avable during building non-editor/shipping version of module and would give you error during packaging.

Those preprocessing conditions allow to build diffrent versions of the code without modifying the files themselves, engine provides different preprocess varables you can use, as well as you can define your own.

If you trying to call function filtered by WITH_EDITOR that means this API is only avable for editor-only use

Can you now run this method in a packaged project?