Anim Blueprint Cast BP message error but works?

Hi,

I have some issue, well, it is working but I still got error message (telling me it is not working…).
It is for a AI character.

I have an anim blueprint, in which when actor is moving turn on some particles/lights, when it stops turn them off.
See screen, but what I do is in the anim blueprint I get the owning pawn cast to my BP actor and from there get my light/particles then on condition isMoving turn them on or off.

If I put my character BP inside the level, and play it, all works and no error. The AI pawn is acting and working with no error message. Lights/Particles turn on and off when needed.

If I spawn the BP after the level is loaded - when the player request a spawn - the AI pawn is still acting excactly how it should, lights/particles turn on and off when needed BUT i got an error message (see attached screenshot).

I am not quite sure why, it seems it can’t load the particles and lights from the variables of my cast. But even thought there is the error message, IT WORKS.

Wondering if anybody has any idea why. Should I just disregard the error?

Also, if it helps, the error only show once. The first time it spawn.

Thanks.

Firstly: Never disregard errors and warnings. Always fix your project errors and gracefully handle them. Very little warnings could be considered OK, but fix them if you can.

Secondly: “Also, if it helps, the error only show once. The first time it spawn.”

That tells me it’s a race condition or you are trying to use variables before they are properly set.

The error in your screenshot says it all. Your two variables, PointLight and FX_Robot_Reactor are not set to object instances when you attempt to access them (you’re calling SetVisibility and SetActive on them.

Before you call SetVisibility and SetActive on those two variables you shoudl pass them through an IsValid? node to make sure they are valid objects before you use them.

Hi Elitereloaded,

You were right! Using the IsValid? fixed the error. I believe you are right, it is just going through it before it is setup.

Thanks for the quick reply and help!