Accesed None trying to read property K2node Dynamic Cast

I am trying to get my character to switch between state machines when he swaps from a rifle to a pistol, I have managed to get it working the way i want it to, however i get this message. it works fine, just the error gets thrown up.

This is where i think the issue is. This is in my anim graph.

286638-animgraphcastto.png

And here is where i set the player weapon. This is in the AnimBP event graph

286639-setplayerweapon.png

I just can’t work out what the actual problem is, i have looked at tutorials that explain the ‘Accessed None’ error, but none of them seem to relate to my problem.

Any ideas?

Thanks

I guess it is a Race condition. The Tick in your animBP fires before you Set the variable. Just Convert the cast to a validated Cast or append a isValid Node and you should be good to go

4 Likes