Getting an error: Blueprint Runtime Error: "Accessed None trying to read property BPPlayer1"

Hi,

I am new to Unreal Engine development, and ran into the following error:

Blueprint Runtime Error: "Accessed None trying to read property BPPlayer1

I am trying to implement a scoring counter anytime the player passes through a ring (1,2,3 ect), but the score just stays at zero and then I get the above error. Any help would be greatly appreciated!

BP_Tunnel calls the IncrementScore3 function whenever the actor is destroyed, and should increment the score by 1. Its target is BPPlayer1 which holds the Score3 integer that should increment.

The BPPlayer1 reference is set in BP_Player.

Any help would be greatly appreciated!

Can you share screenshot or the full log? If your blueprint accessed None it should also tell you in which blueprint and in which node it happened. You are referencing to BPPlayer1 in many places. Basically your error means that your BPPlayer1 variable is not set somewhere and you are trying to do something with it. When variable is not set it’s value is Null and you should not do anything with it. To protect your blueprints logic you should check if specific reference is valid or not with isValid node before doing anything with it.

For example in your BP_Player blueprint you Create Score Counter Widget Widget and then you store it in variable called Score Widget and before that you set BPPlayer 1 to it. What if something went wrong in the Create Score Counter Widget Widget and it was not created? It would return Null to let you know that something went wrong. This is why isValid node should be used, to simply check that your references are valid before working with them.

It seems that my error is coming from the variable BPPlayer1 in BP_Tunnel, I used another isValid node here and it does return false whenever the game tries to use Increment Score 3.

Here is the full log.

The ScoreCounterWidget is displaying when the game starts, but it just displays zero and never increments to one.

I tried the isValid node after the creation of the Create Score Counter Widget Widget and it is printing True when the game starts. I attached a screenshot of how i wired that together, let me know if thats right.

Thanks so much for your help so far!