User Widget inside a TileView doesn't update and only uses default value in bindings

Hi everyone,
I have a problem that I can’t seem to be able to fix. I have a TileView where I want to show a list of items inside my inventory. I have an InventoryItem widget and an ItemGrid tileview, with binding functions for the item icon, background color and text like so:

However, when I play the game the only value I see is the default value I set in the inspector.

Changing the value of item value variable does nothing. I put print statements at the red X and there I have the different item type values correctly, but the only result I see is whatever is in the default value of ItemType.

What’s even stranger is that this doesn’t seem to happen if I use anything other than a listview or tileview. I tried putting a fixed uniform grid and that seemed to update correctly - so the bindings seem to work, but not if the object is inside a listview/tileview?

How do I fix this? I just want to be able to set these values after I make a widget and have it update in the list.

As a visual representation, on the left side is the inventory array (a set of enums).
On the right is how they look (all of them are energy).

Really puzzled by this. :confused:

That’s not how lists work. You never create the widgets yourself - that’s the whole point, the list manages their lifecycle for you.

You handle the data objects the list will use to pull the data out of. If you want to update something, you update the object, not the widget, and then refresh the list.

Check out any tutorial out there. The lists are very different from regular containers. You must use the interface and consider exposing data on the objects, makes life so much easier.

Okay, so is something like this okay to do? Inside that UpdateEverything function are all the binding functions being called manually, which at least makes them display correctly now.

1 Like

Yup!

Hopefully you set widgets fields directly inside: Text Box -> Set Text - this way we update the widget once in an event driven approach as opposed to a function binding that runs the bound function every single frame, non-stop.

1 Like

Okay I’ll make sure to do it that way, thanks! :smiley:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.