Can not cast within any widget blueprints

Does anyone know why this will not work?

Hey there,

So what the issue is that if the cast fails through the ‘Cast Fail’ output of your cast, then nothing is returned. If nothing is returned, then the outside function that takes the ‘Health’ float will receive nothing. This can cause issues.

If your cast succeeds 100% of the time, there will be no issues with this. However, the compiler is telling you that if your cast somehow fails, you’re going to have problems since there is no way for the exec flow to return anything.

Hi,

Thanks for the response

I think i understand, so i only get the error due to the fail output not being used.

Correct.

What you have right now will compile and work, but the compiler is letting you know that there is potential for an error during gameplay

I was wondering about this. My game uses several examples like this; what says makes sense

One more thing; If you are 100% sure that your cast will never fail because you know which object you are getting, you can also right-click the cast node and use “Convert to pure cast”.