Accessed None when accessing Component in AnimGraph

Still unsolved.

When accessing a component of an Actor (Component is added at compile time!) in the AnimGraph’s Update or Initialize Event, it’s accessed None.
The Initialization Order seems incorrect. With a delay it works. Unfortunately I can’t have a delay in Update Animation.

Hi Raildex_,

This is likely because it is not intended to work that way. The way you’ll want to handle casting to a pawn owner to get variables is how we do it in the Third Person Template. You’ll see that an IsValid? check is made against Pawn Owner, then you cast to the CharBP and set a local variable.

You CAN get away with doing it your way at runtime without errors(I just tried it), but the AnimBP is always going to throw those errors with your setup. If you leave the AnimBP open while you PIE, it will also contaminate your logs because the AnimBP Preview Viewport counts as a running instance of your AnimBP with no Pawn Owner.

-Matt W.

I cannot reproduce my problem. I have the same setup in the Update Animation. But I get an Accessed None only ONCE when I want to acess a component. The Component is valid after the first frame.
When I place the Character on the Map (and not spawning it with PlayerStart for example) the accessed none does not occur. Something seems to mess up the initialization. The Animation is initialized before the component it seems.

When you’re attempting to access the “CharacterBP” variable, it has nothing to reference, no component to reference, and hence no variable to put into the “Active Value” pin. Your CharacterBP is not defined, but you’re still trying to access it in the AnimGraph…that’s why you’re getting the error. You need to set local variables that have defaults like I demonstrated above instead of trying to access the BP and/or Components in the AnimGraph.

-Matt W.

Hi. But you are wrong.
The Reference is set in the Initialize Event.
I’m talking about update.