Accessed none trying to read property with anim bp

I just tried this and it still not working, i have the same error as before: Blueprint Runtime Error: “Accessed None trying to read property Casted Character (lantern)”. Blueprint: lanternehands_animbp Function: Execute Ubergraph Lanternehands Animbp Graph: EventGraph Node: Set IsMoving (lantern)

347475-image-2021-08-27-194839.png

I would change the parent class back to the original class. Sorry this was bad advice.

It’s hard to give you any advice because the problem is across multiple classes and blueprints. You can only cast an object if it’s a child class.

On your animation blueprint, if you just want to “GetVelocity”, you can do this with any actor, so you can just plug in TryGetPawnOwner directly to GetVelocity without casting.

This is the best advice I can give without changing multiple classes. Try to watch tutorials about UE4 classes and child classes and build your knowledge there.

hey i have an anim bp for a lantern and a walk and idle animation, to play the walk animation i have a boolean that is set to true when the player is moving but here it doesn’t work, it says that there is no boolean value but it works on my other anim bp with the exact same script, can someone help?
the first image is the script that is supposed to work and the second is the cast to character function

sometimes BlueprintUpdateAnimation will start running before the pawn can be casted.

You’re tyring to GetPawnOwner before it is valid. You need to wait until the pawn is valid before you can do anything with it.

The easiest fix would be like this (you need to create the StartTicking variable):

try this and hit play:

Does it say “Hello” in the upper left?

nope, but it works on my other anim bp idk why tho

Not sure why, it looks like your Pawn is not a First Person Character

Try moving the PrintString node to before the Branch node, and see if your Pawn is valid

If it’s a valid pawn, then your Lantern object is not a child of the First Person Character class

I dont know how you would want to fix that, but you could reparent your Lantern class to the FIrst Person Character class like this:

okay now that i’ve changed the parent class to the first person character i can’t play and i have this error message with another anim bp: Infinite loop detected. Blueprint: hands_animbp Function: Sequence Call Stack: Show
But in the editor the print string works so i think that was the problem but it broke my other anim bp
(the hand_animbp has the exact same script as the lantern one but this one worked fine without any errors)

okay thanks for the help even if it didn’t worked, but maybe if i tell you what i want to do you could help me find another way to do it?

yea sure i will try to help

thanks! so basicaly i have my hands that i attached to the first person character and i attached the lantern the one of the hands and its working perfectly fine with animations, but i want the lantern to move back and forth when the player is walking but what i tried to do with the anim bp didn’t worked (sorry my english is not that good so its hard to explain) do you know how can i make it move when the player is walking?