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.
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?!
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").
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
If that is your plugin, you should make it 100% clear on the marketplace page if the plugin requires the project to support C++ or not. Right now, to me it seems as if it does, which disqualifies it for us.
The solution I posted works for those who do not wish to have C++ at all.