The KEditorUtilityWidget class provides overrideable functions to hook in and out of Play-In-Editor mode so your Editor Utility Widget can access objects in the correct world. You can use this as the basis for an Editor Utility Widget or use it to be able to reuse normal widgets within Editor Utility Widgets. In the latter case, you need to pass the PIE world to the normal widget and you need to be careful that functions where world context matters (ie. getting or interacting with runtime references) have world context exposed to be used which may require C++.
Override this function to receive the Play-In-Editor world context to pass to widgets that need it. Also used for initializing on PIE if needed.
Override this function to clean up when Play-In-Editor ends. Make sure to clear all runtime references including the world context if widgets were using it.