Daily Unreal Column #41 - Editor Utility Widget World Reference
When creating tools using editor utility widgets you can notice that by default the widget doesn't have world context. Here is how to get one.
There is a lot of functions that require a valid reference to a WorldContextObject
. These functions use this object to access world reference. Unfortunately the editor utility widget doesn't have such object so it cannot use these functions out of the box. You can notice that functions as simple as `Print String` require you to pass world context object. Luckily there exist `Unreal Editor Subsystem`. We can use it to fetch both editor world or game world. Both of these functions return valid references that can then be passed to all functions requiring world context object. See an example below.