Character Not Valid in Animation Blueprint

Hey All,

Been a long time since posting here. How are you doing?

So I’m having trouble with my Animation Blueprint for one of my AI-driven characters. It turns out, the AI works great, but the Animation Blueprint does not.

I’ve tried a Print String node on every branch of that sequence here, and found that it is not receiving Exec from Update Animation, due to the Character Reference not being Valid.

My State Machine is in perfect working order, there are no bad rules in it.


I don’t know if it is my Mesh or not, but it seems that it may be the culprit. It has a Root and operates just fine in Blender.

In addition, I looked up other possible culprits on the internet, but applied their solutions to no avail.


Paths

What could possibly be making my character invalid? Interesting fact, after plugging in a print string to the success and fail Execs on my casting, it seems that the casting only works 50% of the time as well.

Your character variable is invalid because you are not setting it anywhere. It’s a nullptr until you pass in a value to set it.

During “Event Blueprint Initialize Animation” where you have get owner casting to a character node then you should get the out pin an pass that to set the character variable.

If you character variable is of a specific blueprint implementation then get owner and cast to the variable type and then set it.

Oops. That was obvious, lol.

Thanks. I will try it and see if it keeps doing the same thing.

3dRaven, you are awesome! This little common mistake was fixed and now it runs 50% better.

The other thing that seems to be happening is my Character Blueprint is not communicating with the Animation Blueprint.

The cast seems to be failing-- any idea why?

Does the mesh component “Mesh” have it’s anim instance set to the ABP_…V2 anim instance type blueprint?
Is it of type skeletal mesh component? (Only those can have anim instances if I remember correctly)

Forgot to put this in the original posting:

It should work. You could try adding a 0.1 second delay before the cast just in case. Perhaps it’s not initialized? Sometimes unreal has these quirks.

Is this a multiplayer game or single?

Single so far, but there are plans for multi.

I’ll try that. It’s currently connected to the Character BP’s BeginPlay.

You could also push this function to a place when you need the variable. Then check if it’s valid, if not then go through the init process that you now have at begin play.

You are a lifesaver man. Keep up the good will.

Trying this now.

Apparently, because it is an AIController controlling the Character Blueprint, the normal Movement Input scripts do not apply. How do I get into those AI movements? Should I get into those?

Ai is usually guided by behaviour trees.

Inside of them you usually call ai move to in specific behaviours.

How would you access turning behavior? Specifically?

AI characters move along paths that are generated by the navmesh. You don’t steer them in the way of “go forward”, “turn left” etc.

So there’s no way to assign turn animations to their movements?

Check some tutorials about AI. It’s a rather broad subject. It would take a lot of explaining but there are a lot of resources out there that will explain it better and faster than I can.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.