"CastTo" is no substitute for "IsValid?"

Hey,

Just something I learned the hard way. I figured I’d share.

I had a problem where I’d disconnect my client from the server and the bots would fail because the player wasn’t there anymore. I was using a “CastTo” node to see if the target was good.

Apparently that node doesn’t account for much beyond casting. Things like “pending kill” (my issue) don’t get caught. When I added an IsValid before the cast, the problem went away.

Another note: the “IsValid” function (the one that returns a bool) isn’t a good substitute either because it needs the pointer to be valid in order for it to check that the pointer is valid. I’m not even sure what it’s for.

In short, the “IsValid?” node is the lord of all validity.

Cheers,