Blueprints runtime Error : "Accessed None trying to read Property"

Hello, i’m trying to send an attack when i click on left mousse button but i get this issues : Blueprint Runtime Error: “Accessed None trying to read property CharacterRef”. Node: Branch Graph: AttackConditions Function: Attack Conditions Blueprint: CombatStatusComponent.
i don’t understand why my character ref is null, while i set it with a cast to character node.
Can someone help me please?

You’ll have to share the blueprint.

Cast doesn’t set anything, it just changes the type. Take note of the “IsValid” and “IsNotValid” pins.

here where is the issues :


here is the event call in the component with the errors :

and here is the part in the bp_playercharacter

and yes i know that, and normally the is valid node is not the issue.

So that shows where you use the CharacterRef, but not where you set it.

If you don’t want to bother holding a variable reference to the player, you can use the GetPlayerPawn node and cast that to the player type.

my bad sorry,
here where it is set in my component :

When do you call “Store Components”? The simplest answer would be that “Attack Conditions” is being called before “Store Components”.

What @FishBabe said, but also make sure that casting to character actually works.
Make sure it doesn’t lead to cast failed.

it’s not possible i initialize store component a the start of the game and attack conditions fired when i left mouse click