Blueprint Runtime Error: Accessed None trying to read property K2Node_DynamicCast_AsThird_Person_Character from function: 'Reload' from node: Return Node in graph: Reload in object: Weapon_Base with description: Accessed None trying to read property K2Node_DynamicCast_AsThird_Person_Character
I try to use is valid like this but it show same error . How to fix it ?
The out bool parameter will try and get a value from the connected nodes even if those nodes are behind a branch. IMO you should have a return node connected to each Cast Failed to ensure it doesn’t hit a dead end when trying to get a value from a null source.
If none of you condition end up at a return node, the function should still work and the bool parameter should return false. So you do not HAVE to add an extra return, it’s just a suggestion for clarity sake.
The problem with the original image is that hes trying to get a value that seems to be later in the execution order.
In your prev example if the cast fails you should get the print and false on the bool, so should not crash from a null value since each return node and nodes associated with it are behind a check (the cast).