[4.6] Breaking UMGs with circular references

My project uses lots and lots of user-created widgets and many of them reference my Blueprint GameState class via a cast to call events and bind to dispatchers, while my own GameState needs to reference some UserWidget classes to add them to the screen when some things happen.

For example, when the game starts the GameState adds a LevelSelectWidget to the viewport. Selecting a level on the UMG widget calls a function on the GameState that does some bookkeeping and loads the level.

I don’t think I’m doing anything arcane, unless I’m the only person using UMG and placing UserWidgets inside other UserWidgets (which I find it hard to believe) and doing basic blueprint communication (maybe people add all their logic directly into their Widgets and don’t practice any code reuse?).

Re-working my project to avoid the circular reference would require me to place all functions I use on my GameState behind an interface (and remove the casts) and move the event dispatchers to another singleton that references nothing else, but it doesn’t guarantee I won’t run into it again, because I just tested and the problem happens no matter how deep the circular reference is (so if my UserWidget I reference a class that references another class, that references another class that references another UserWidget that contains an instance of the first UserWidget, things still break).