Items in Tile View not displaying,

I’ve been putting together an inventory system for an RPG, where the player can expand their inventory by equipping new clothing.

To do this I have an Inventory Component which creates a widget for the inventory HUD, inside of this HUD widget is a List View with each item being a piece of clothing that adds extra spaces, and each piece of clothing has its own widget with a Tile View in it that should be filled with a number of item slot widgets.

Here’s what it looks like in the widget preview:

Screenshot_55.png

Here’s what I’ve got in blueprint:


It’s getting the ItemSlots variable from the clothing blueprint and creating an item widget for each one and adding them to the tile view, I’ve confirmed with Print String that the item widgets are being created and I made sure they inherit from IUserObjectListEntry which is all I need to do as far as I know.

However the Slots don’t appear when I run the game:

I did some experimenting since Tile View is new to me, I went into the blueprint for the clothing widget and set it to add an item to the Tile View on construct, I didn’t think it would work because it was asking for an object reference not a class reference:

For some reason it worked and spawned the item slot widget:

Screenshot_57.jpg

So then i tried making a custom event and having the inventory component call that event:Screenshot_60.png
Screenshot_61.png

But that doesn’t work, it comes back with a blank clothing widget when I run the game.

I’m at a loss, Can someone help me to understand what is going on here? Why are the item widgets not displaying?

The listview generates an entry widget for the items added to the listview.
If I add an UObject to the listview, it will generate an entry for that item.
If I add an Actor to the listview, it will generate an entry for that item.
If I ad a Widget to the listview, it will generate an entry for that item.

As you can see, the displayed entry widget is not the item - It is not the widget you passed into the listview.

You’re getting a Tile to show up when you add an item to the sub-TileView on construct, because that the logic the entry widgets runs when they get constructed.

Then your custom spawn tile event doesn’t work, because… well it’s a bit hard to follow the logic here. This puts the movie Inception to shame. I assume you’re calling Spawn Tile on the ITEM widget, which does perform that logic, but it is not actually displayed.

Oh, the widget that shows up in the fifth image looks different because I changed it when I was doing testing (wanted to make sure it wasn’t some display or graphics issue).

But I think I get what you’re saying, the widget I set in the Tile Views “Entry Widget” is what gets displayed regardless of what items I add to the List, be they actors or widgets or whatever.

As for where the logic is taking place, it’s all done inside of the inventory component,

  1. First it generates the main Inventory widget which has a list view inside.
  2. Then, for each clothing item that is equipped, it generates a Clothing Widget and adds it to the list view above, this Clothing Widget contains the Tile View
  3. Then it checks the clothing item, gets the number of slots it has and generates an Item Slot Widget for each and (should) add them to the Tile View

All of this logic is taking place inside of the Inventory Component, if I move this logic to the widgets themselves will that get the slot widgets to display?

Precisely.

I think it will help if you don’t create a widget to add it as an item. Instead, create an Object class and add logic. Construct objects as needed and pass them to the listviews. Then it is much easier to separate what happens where.

Using a widget as an item, and having it be the entry widget makes it quite confusing just what instance is where. At least when learning.

Thanks for your help so far!

Ok so working off of your suggestion I’ve changed the script to pass through the actor references into the List and Tile Views rather than widgets but now I’ve ran into another problem.

I need to get the reference for the clothing object to figure out how many slots need to be added to the next tile view, but the “get list item object” node there is returning a null value. It’s supposed to get the Object in the List View associated with the entry, I’ve left the entry input null as the node description tells me it should default to self, but just In case I also tried plugging a Self reference node in there and it still didn’t work.

How do I get a reference to the Object from the Entry Widget?

I’ll point you to this post- Listview - getting started in BP - Community Content, Tools and Tutorials - Unreal Engine Forums

The entry widget gets informed about what item it represents during the “on list item object set” event, part of the interface.
Don’t rely on the entry widgets construct event, because entry widgets are reused as you scroll through a list. Instead, you have Generated and Released events.