Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to check if game is running

I'm creating an editor plugin, and depending on whether the game is running or not I need to get either pass either an object from a level (if the game is running), or use the editor world itself.

For that reason, I need the ability to know whether we are running the game or are still in the editor.

Preprocessor directives "#if WITH_EDITOR" and the likes do not work because they tell about the build configuration, not whether we are actually in "edit-mode" or playing the game. Any advice?

Product Version: UE 4.20
more ▼

asked Jan 18 '19 at 03:01 PM in C++ Programming

avatar image

72 5 9 16

avatar image OverRated_AU Mar 02 '19 at 06:35 PM

Just make your own node. alt text

avatar image goncasmage Mar 12 '19 at 06:22 PM

What does that node do?

avatar image OverRated_AU Mar 12 '19 at 10:27 PM

Just returns if the game is running in the editor it not.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first
more ▼

answered Jan 22 '19 at 12:28 PM

avatar image

1.5k 15 9 33

avatar image Quexlaw Jan 22 '19 at 01:33 PM

Sadly I can not do that, because when in editor, trying to get the world of an object returns null. When the game is running, I want to access the object's world. When it's not running, I want to access the Editor World. I guess I could try and get the object's world and if it returns nullptr I can just use the Editor World instead...

avatar image AmphDev Jan 22 '19 at 01:59 PM

GEditor->GetEditorWorldContext().World() should return editorworld i think

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question