Download

Spawn Exposed Variables are empty in created UI Widget (Uniform Grid Panel Item)

Dear UE Community,

I am currently working on an ingame HUD (UE 4.24) for a game and am going crazy about a seemingly very simple thing and wanted to ask if someone knows if I’m doing it wrong or has ideas how to apporach this in a better manner.

I have an ingame HUD that looks like the following:

What I try to achieve is that when the “Build” button is clicked, the grid should be populated with buildable items. The items are of a separate widget class “BuildMenuItems”.
Creating the items runs in the button released event of the “Build” button:

Here want to set some variables (I tried different types for testing purposes, Text, String, Int) that are then available in the item construction (to display as item name). The items are created and the layout is visible in the game but the values of the spawn pin variables are all empty.

The Problem:
In the following BP which is the BuildMenuItems BP I want to work with the variables that I passed via the spawn pins of the widget but all of them are empty. Does anybody know why or what I am doing wrong? It might be a noobish question but for me it would make perfect sense if this is working like I tried but maybe I am just not understanding how references / object instances work in BP.

In the above example I am just printing the values of the variables. All are empty. I tried it with every available event. It triggers but the values are just as if they were never set in the spawn pins. I also tried to feed the values in different ways to the pins, removed, readded, refreshed the creation nodes etc. I don’t understand why this is not working…

So far, thanks in advance for your time! :slight_smile:

Okay I found out what I got wrong:

  • I thought I was using a Uniform Grid Panel but instead was using a TileView component
  • The TileView is a list and behaves differently from a Uniform Grid Panel. It has some setup to be done before you can use it as I want (found it in this post: https://forums.unrealengine.com/comm…-started-in-bp)

I noticed that all examples for the grid panel use a “Add Child to Uniform Grid Panel” method that was not available in my BP and then noticed that I was actually using a list…