Download

Branches not working in a widget blueprint

This is a little widget I did to display ammo in the same colour as the projectile it is firing. As you can see all the options now go to setting yellow as the colour. I set it up with the correct logic to start with and it went from red to blue, but yellow always showed as red. I then tried a few things to no avail. In the end I have the graph you see. This graph should only produce yellow, but it only produces red. Am I missing something blindingly obvious or is UE messing with my head?

Attachments missing?

Attached now. Good spot.

Is there a chance your cast is failing for some reason? If the current graph you showed us is returning red, that implies that its not reaching the end of that chain for some reason, and the only place that it would fail, is at the cast failed node.

Oops, I also notice that you are using the Set Color and Opacity node, but you havent actually submitted anything to your return node. So its defaulting to the default color. Here’s how your graph should probably look:

WidgetColors.JPG

The Set Color and Opacity node is overkill because technically thats what’s happening at the end of this function regardless, and it might end up messing things up if you are setting it twice every frame. this might be a good place to use an enumeration, if you are going to have many different types of balls because then you could use a switch statement or a select node to choose your colour without dropping through a bunch of boolean chains.