I cannot get this widget to hide at this node. When I set the widget to hidden from the details, it is hidden. If I then set this node to visible, while the widget is set to hidden from the details, it makes it show (so I know the reference is good). The next Set visibility for a different widget works as expected. The widget that is set to visible in this screen shot is set to hidden later in the flow and that works correctly.
If do a set visibility hidden in the same flow where the widget is created, it is hidden as it should be.
No matter what I do, I cannot get the widget to hide at this node, and it seem to be a problem ONLY at this spot and ONLY for hiding it (making it visible here works). I have also tried hiding specific components of the widget (which is actually what I will want to do once this works) and that did not work either.
There are no animations in this widget.
The widget is just a 2x2 image wrapped in a boarder on a canvas panel.
What is going on?
Edit: After further testing, it seems I cannot hide it with Set Visibility anywhere except immediately after it is created and added to viewport. I also cannot Set Render Opacity.
I am doing all of this in the same event graph where the widget is created and added to viewport.
I’d have to look at your code to know for sure. Are you running a For Each Loop or Tick or the Triggered pin of an Input Action in association with the widget’s creation?
No loops in the creation. It happens in the BeginPlay event of the player character bp. Its the UI HUD widget. I just added the Get Player Controller to try to fix this duplication, no effect.
Now that I see this is the problem, I suspect all of these widgets have multiples.
This is being run on the player pawn blueprint. You mean move the widget creation to the player controller? What event should I use to create the widgets at spawn, does the beginplay event in player controller run on all instances as well?
Edit:
It seems I was able to answer my own question with some testing. I moved all the creation actions to the player controller and setup a couple of casts to manipulate the visibility of the widgets instead of using the reference variables I had setup. Everything seems to be working and I verified there were no duplicates with get all widgets of class>for each>print index.
I would still like to know if beginplay in the player controller is the best place to create the widgets on player spawn, or if there is a better way to do it.
Thank you! It would have taken me a very long time to figure out there were duplicates on my own.
This also makes me wonder: I am setting a camera reference in the BeginPlay event in the player blueprint (where I was creating widgets before moving them). Is this going to cause a problem similar to the widget issue? I haven’t noticed anything… yet…