Download

Check if Blueprint is being run within the editor (i.e if WITH_EDITOR in C++)

I’m looking for the Blueprint equivalent of #if WITH_EDITOR which is used in UE C++ to run perform certain actions only if the game is running within the context of the editor.

The main intention is to add useful debugging information in exceptional scenarios. Eg: Cast To MyActor fails and I want to print a simple message to the screen so I know that. I realize I can use the output log for this but I find it too verbose for this purpose. So does any such node exist to determine if game context is within the editor?

Not sure if the fact that blueprints being converted to a different form while cooking the game prevents such a check from being feasible.

Bump. I’m having the same problem, anyone have any solution?

I can’t believe that there’s no answer for this question!
The best way I know is GetPlatformName node, but I don’t think it’s a good way, since it only returns Windows for PIE.
So is there really no BP equivalent for WITH_EDITOR?!

1 Like

Bump…Bump…

Yes im sure ive seen a bp node already that does this i’m not at my computer right now but I’ll look later and post it if I find it

Or you could do it yourself simple make a c++ function like this

//! Allow the blueprint to determine whether we are running with the editor or not

UFUNCTION( BlueprintPure, Category = Whatever )
bool IsWithEditor() const
{
#if WITH_EDITOR
return true;
#else
return false;
#endif
}

Yes. I think I found a method. Try Is Shipping Build node. Make a branch and if Is Shipping Build is equal to true, then do whatever you want and if it is false, then do nothing. I tried it in 4.13 and it works.

Add a custom option, such as “-editor” inside the server game options line, found in Edit->EditorPreferences->Play(LevelEditor)->MultiplayerOptions->ServerGameOptions.

Then make a macro or a global function in BP to GetGameOptions->DoesOptionExist("-editor").

Rama’s free Victory Plugin has a node to identify whether game logic is running in Editor,PIE,or Game World!
https://forums.unrealengine.com/showthread.php?3851-(39)-Rama-s-Extra-Blueprint-Nodes-for-You-as-a-Plugin-No-C-Required!

Also the free Low Entry Standard Library plugin has a platform node (not exactly what you want, but it also has other useful stuff )

Since this is where google led me and it has NOT been updated, there is a ‘With Editor’ node now… You can just use that (its in the same place as the Is Shipping, Is Debug, Etc nodes)

Where are these With Editor and Is Shipping nodes that you speak of? I’ve tried adding using them in Blueprint in 4.24 but these nodes don’t exist. I’ve unticked Context Sensitive too, but they still don’t show up?

A bit late but in case people are still looking for it (like me XD )

There is the node “Print String”, which spawn the message you want in the editor during play.
Not sure if it’s what you are looking for as I don’t know C++, but here you go
Print-string.PNG

Same issue here. Were these removed?

Or did the name change? This thread is literally the only result if I search for it.

Maybe the poster was using someone’s 3rd-Party Plugin and forgot???
You could give this a try, can’t link to it but its the last post on the page.

Disclaimer: Didn’t do a whole lot of testing on it.

As of 4.25, this is the correct answer:

Capture.JPG

Thanks, this is exactly what I was looking for!

This is NOT correct answer, as this have next code inside:

	static bool IsPackagedForDistribution()
	{
#if UE_BUILD_SHIPPING
		return true;
#else
		return false;
#endif
	}

Correct answer is to create Blueprint Library using C++ and use solution from @EniGmaa .