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"

Getting world in a editor plugin

Hi,

I have an UObject which is not in the world (just created with NewObject), and I need to create an object in the world from it. I have tried GEngine->GetWorld() and GEditor->GetWorld(), but both of them returned wrong values. I finally did it, but it's really, really awful:

  TArray<FEdMode *> arr;
  GLevelEditorModeTools().GetActiveModes(arr);
  arr[0]->GetWorld()

Is there a better way to do it?

Thanks, Tavon.

Product Version: UE 4.5
Tags:
more ▼

asked Jul 11 '15 at 01:21 AM in C++ Programming

avatar image

Tavon
3 2 4 6

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

1 answer: sort voted first

I'm using this in my plugins, is this what you are after?

 GEditor->GetEditorWorldContext().World()

more ▼

answered Jul 11 '15 at 07:06 AM

avatar image

Goomii
136 2 10 12

avatar image Tavon Jul 11 '15 at 09:18 AM

Yuup that's it, thanks a lot !

avatar image intoxicat3 May 26 '17 at 04:45 PM

Thanks! Anyone know how to get PIE World in Editor Plugin? Method above will always return editor world not PIE World.

avatar image Horny-Squirrel Aug 15 '17 at 08:37 PM

thanks! this was really useful

avatar image ZioYuri78 Dec 19 '17 at 10:05 AM

You saved me \o/

avatar image StarryFire Dec 24 '18 at 10:21 AM

This is not working anymore. Its causing crash :(

(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