Basically, my game involves a component where The user clicks a button on a UI widget, which prompts the game to check whether a certain task has been completed, in this case, taking the bins out.
The “Bin” actor is simply set up so that, when interacted with, checks if the bins have already been moved, and if not, the bin moves in the world, and sets the “AreBinsOut?” variable to true. I know it’s being set succesfully because the interaction works as intended, and does not complete.
So, in my UI Widget, when the player clicks on this specific button, I want it to check the value of the “AreBinsOut?” variable, and return a different message depending on whether it is true or false. So, I create a custom event, and cast to bin, and ask it to read the Are Bins Out variable. However, the cast is failing every time, with the log providing the following error:
“Blueprint Runtime Error: “Accessed None trying to read property K2Node_DynamicCast_AsBin”. Node: Branch Graph: EventGraph Function: Execute Ubergraph Message Screen Mum Blueprint: MessageScreenMum”
(Note: MessageScreenMum is the name of the widget with this interaction happening)
I’ve read a whole bunch of documentation and watched videos explaining casting, and I still don’t understand what is happening here. The “Bin Reference” variable is set to an Actor Object Reference, and it knows that the Are Bins Out variable is an option, but it’s just failing every time?
Even if I add a variable that has a direct reference to the Bin object, like in the below picture, the value is always returned as false, even if the AreBinsOut value is set to true.
I’m just so confused at this point, any help would be greatly appreciated!