Download

Spawn Queue System and Displaying through Widget

Hi, I’m currently working on my first personal project which is going really well so far. However I’ve hit a road block.

My game involves the player Character collecting PickUps in a level, these PickUps then update a Spawning System Object that stores whats been collected in an Array called ‘EnumInventoryArray’. The Array’s 0 index is used to determine which environment object to spawn next. So, if the Character collects 3 Pickups, the Spawn System will cycle through the Array, spawning each object until the Array is Empty (Which I’ve set as an Enum called Nil). This system works so far. If someone can recommend a better way to build what I’ve attempted then I’d like to hear it.

My problem is that I’m not sure how to translate the ‘EnumInventoryArray’ into a hud/widget display, like the ones you get in RTS games where there are production queues showing which units will be spawned next. I’ve got a widget with a set of 5 image slots which I’d like to be updated using the current contents of the ‘EnumInventoryArray’ elements to select which image to be displayed.

What I’m not clear on is;
1)how to get a reference of the Widget to the Spawner Object bp so it can update the Widget? I tried Creating the widget in my HUD bp, then promoting it to a variable, then getting a reference to that through casting to the HUD from the Spawner Object bp, however the Variable reference for the widget returned Failed when cast to in the Spawner bp?
2) What to do with the Array once I have it being correctly updated in the Widget?

Appreciate any help, thank you