reference to BP always 'none'

Hello,

I have a UserWidget (T_HUD), that has a set of button widgets (see 2nd image). T_HUD is created & added to the level in the level BP. So far so good.

The buttons are created from another UserWidget (called ‘T_Slot’). In the T_Slot BP, I have an event for mouseEnter & mouseLeave that changes the image of the button. Also Fine.
The problem I’m having, is with the event for onClicked. If I click a button, I want to store the name of this button in a variable VarBtnClicked in the T_HUD BP. I have tried this in many different ways, but the variable VarBtnClicked is always ‘none’.

So, I created a variable VarTHUD in the T_Slot widget, set its type to ‘T_HUD’, set the property ‘editable’ = true, and compiled the T_Slot BP.
In the T_Slot BP, I then called : onClicked >>> set VarBtnClicked (target = VarTHUD ; VarBtnClicked = self) >>> print string (VarClickedBtn >>> getDisplayName). This always prints an empty string …

42720-referenceerr.png

I also tried to set a default value for VarTHUD in the TSlot BP, but I can only ever select ‘none’ …

What am I doing wrong ???

EDIT 1 : When I cast varTHUD to T_HUD, it also fails …
EDIT 2 : I understand this is a nullpointer exception, but what I don’t understand is why. Why can I not get a reference to another BP from my current BP ???

so i might be reading this wrong but… what if you add a string to both widgets and on click you cast to the other widget and set its string to the first widgets? than each button you make you can set a different default string value?

I’m not entirely sure I understand what you are saying (I can program in Java, but I’m very new to blueprints) … Can you explain some more please ? And thanks for trying to help me !

I was able to solve part of my problem by putting my varClickedBtn in the TPlayerController BP instead of in the THUD BP. Now I can set it and read it. Not really how I wanted to do this, but …

What really bothers me though, is that I don’t understand why the reference to the THUD BP is NONE …

ok so i did some testing on my end. here are my results. like you i could not set anything but none, if i getDisplayName>Print string a widget object that is being drawn to screen it works correctly ie it writes its name, if i do so from the manually created variable nothing is drawn.

if i set my manually created widget component to one in the screen it will properly display the name as expected.

there’s only one major difference from my graph to yours and that is the set box, yours takes 2 arguments mine is only taking one… mine was created by just dragging the variable on to the graph…

also possible issues the variable types MUST be exactly the same… (there’s exceptions for inherited stuff but that’s out of this scope)

the value will stay none untill it has successfully been set.