So I’ve been making use of the amazing slate system along with Unreal’s plugin functionality (great job on that, Epic) to create a plugin that allows for the “dumping” of a 2D grid (like in a Civilization game) on top of 3D world geometry. Part of the plugin involves an editor mode that allows for interaction and manipulation of the grid (again, this is an IN-EDITOR, NOT RUNTIME module). Everything was going well until I ran into a problem (possibly an engine bug) relating to config variables as the world is being saved (via CTL+S).
I have a small global ConfigManager that is responsible for maintaining a few properties that is used to draw the actual grid on the screen. My issue is that whenever I tried to save a level while also drawing the grid and reading from these variables (which it must do to draw each frame), I would crash due to trying to reference some crazy overflow value from an array resulting from a corrupted config variable. I’ve done a lot of debugging and confirmed that during the save event the config variables become temporarily corrupted, but are returned to their proper values upon save completion.
In an attempt to cleanly fix this issue I’d like to add handles to UEditorEngine::OnPreSaveWorld and UEditorEngine::OnPostSaveWorld to make sure that I don’t try to render during a save. Unfortunately I’m at a loss of how to do that. Do I need to derive an entirely new UEditorEngine for the editor to use? That seems unnecessarily bulky, but I’ve been unable to find any help online other than the minimalist official doc pages.
Any advice on adding those handles or otherwise fixing this issue? I’d like to avoid keeping local structures to keep track on the config data and updating it as needed if possible. Thank you so much!