So, after a couple of hours of pulling out rest of my hair, I have found issue specific to my project relating to this error:
I had created a Main HUD Widget, this widget has several children widgets in it. I had created a custom user widget which in itself contains several dynamically added custom user widgets. In case you haven’t guessed yet, it is for my Inventory system.
Now, basically, what I have is Main HUD widget with what I’m calling a Vendor Panel. Vendor panel has a couple of animations that play, through context of a custom event in Main HUD graph. Vendor panel itself has some logic. main portion of Vendor Panel contains a scroll control which I am adding VendorItem widgets to based on Vendor’s inventory. VendorItem widgets contain several buttons, i.e. Buy, Info and like. When you click one of these buttons, Main HUD will play an animation and for example, bring up Info Panel.
UNFORTUNATELY, this brings up a major circular reference issue - Main HUD references Vendor panel references Vendor slot references Main HUD.
When you click Buy button, lists have to be refreshed. So button calls a Refresh custom event in Main HUD which in turn calls a refresh in Vendor Panel. This type of pattern requires decoupling Main HUD from VendorItem slot widget. way that I’ve dealt this this type of issue in code is to pass an anonymous function pointer as a parameter, so that circular reference is removed. This way, one class doesn’t need to know about other in order to initiate some functionality.
I found this by accident, when I clicked on Vendor panel variable in graph of Main HUD, I saw that variable type had changed from ‘VendorPanel’ to ‘REINST_VendorPanel_C’ or some such. So, being unable to remove control directly from Graph view, I clicked on control in Desigenr — BOOM! UE4 triggers a break point! Oh, no! So I have to remove Vendor Panel from desiger by actually deleting its parent, which is a Vertical box.
Interestingly, when re-creating Vendor Panel in Main HUD, and running game, everything is all fine and dandy. Buying items left and right, refreshes occuring without a hitch. BUT, when closing editor and restarting from Visual Studio, blueprint can’t compile!
I haven’t implemented other button containing panels yet, but I’m pretty sure that if using same pattern described above, I’ll get same issue. I’m finding it difficult to avoid circular references in blueprints, that is particular when you compile one blueprint, another one gets decompiled. Perhaps some kind of warning from event graph could be useful for helping avoid these problems.
In meantime, gonna have to use interfaces and dispatchers to get this to work without breaking.