x

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
Tags:
more ▼

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

avatar image

Quexlaw
72 5 9 15

(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

AmphDev
1.4k 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