External Objects
Last updated
Last updated
Both the item struct and container struct has an array of ExternalObjects. There are helper functions for both adding and removing widgets from this array.
What this array allows you to do is have other widgets receive the same update events from the I_ExternalObjects interface that the item widget and container widget receive without using delegates, which listen to ALL events, where as these events are item and container specific. This can be used for hotbars, ammo counters, quest trackers and more where a specific item needs to be monitored. The example project uses the tooltip widget as an external object, where it is listening to the override settings getting updated so it can update in real time alongside the item widget.
For your external widgets to receive these updates, you'll want to go to your class settings (1) and implement the I_ExternalObjects interface (2). You'll then see a IFP|External Objects category with all the update events. Some of these are limited to just items or containers and some are sent to both.
Utilizing external objects can replace delegate events from the component, but there are still moments where delegates are better, for example a quest tracker keeping track of how much of a specific item data asset you have in your inventory.
The good news is, you don't even need to modify the I_ExternalObjects interface class. Just simply make some interface, create your function and use the GetObjectsForItemBroadcast to get all the objects that want to listen to the event