Is Viewport in Editor?

Hi,

Is there a blueprint node/variable that can tell me if the current viewport is running within the UE4 editor as opposed to the viewport of a cooked/packaged exe?

There is a ‘#if WITH_EDITOR’ in C++. Not entirely sure about the blueprints but you may want to look into that variable for a blueprint equivalent.

Thanks Dune,

I did a quick search in the docs/wiki/forum and found several code references to WITH_EDITOR,
unfortunately there was no mention of any equivalent Blueprint usage.

Hopefully UE staff can confirm whether or not there is an equivalent blueprint node/function I can use.

UE is quite flexible so I wouldn’t be surprised if there are other ways to test for IsViewportInEditor.

I could probably write some C++ to expose the WITH_EDITOR state to a blueprint but I’m trying to stay ‘pure blueprint’ for now. We’ll see.

Anyone on staff with any comments?

Is there anything like a [IS_VIEWPORT_RUNNING_WITHIN _EDITOR] blueprint node?

Thanks.

I’ll assume it is impossible.

Hello ash22,

There is no direct way to check and see if the your game is running in the editor via blueprints. However, if you could provide more information as to what it is that you are trying to achieve I may be able to supply a workaround more specific to your issue.

It isn’t really an issue per se, more a convenience.

Basically, I use on-screen debug info in the editor that I don’t necessarily want to see when the standalone game is launched. I manually
turn debugging off when I don’t need to see it in a cooked project, but thought it would be nice if I didn’t have to, i.e. some IsRunningInEditor flag & branch would do it automatically.

Not a big deal.

If I really need it I supppose I could write a BP wrapper for
#if WITH_EDITOR.
I just thought there might exist a reciprocal BP call for that particular C++ property.