Accessed None Trying To Read Property

Hi , I am trying to cast a boolean from my WeaponBlueprint to my Animation Blueprint , casting worked fine with my FPS character but when it comes to my WeaponBlueprint , nothing seems to work. Instead , it kept coming up with one same line of error , here are a few pics of my blueprint.

The most likely culprit is your weapon Blueprint is not using that Animation Blueprint. “GetOwningActor” only works if the owning actor actually uses that Animation Blueprint. If you want to keep pretty much the same setup get the reference to your weapon within your character blueprint, if you haven’t already, and then you can read the boolean value from that reference and pull it straight out of the same character blueprint cast.

Yes my weapon Blueprint is not using that animation blueprint , is there any way I could get the reference value from the Weapon Blueprint straight to the Animation Blueprint without having to create another variable on my FPS blueprint?

The only other way is “GetAllActorsOfClass” but doing that on Tick, which is what animations operate on is a bad idea. but there is a way to do it.

If you cast to the weapon blueprint and then gate it through an isvalid node it stops it having to execute every tick.

This of course will only work if you have only 1 version of it in your world.

I would still personally recommend keeping the reference in your character by doing the same at begin play or whenever you equip the pistol but if you want to do it all in the anim blueprint the above example will work if you only have 1 copy of it.