How check if a character have been destroyed

Hello,

How can I check if a character reference have been destroyed or not via blueprint ?

I found a post saying there is a method to do that, it’s called “IsPendingKill()” but it’s only on c++ and not on blueprint, but the post is kind of old, what about now ?

There look like is still no IsPendingKill function node in blueprint, i tried to use a “IsComponentBeingDestroyed”, but a error log say that my character is in pending kill and the problem keep the same.

How can I check that in UE 4.9 ?

Thanks for your help :slight_smile:

BP IsValid function is your friend.

bool UKismetSystemLibrary::IsValid(const UObject* Object)
{
	return ::IsValid(Object);
}

FORCEINLINE bool IsValid(const UObject *Test)
{
	return Test && !Test->IsPendingKill();
}

That’s perfect !

Thanks you :slight_smile:

the other thing you might wish to look at, instead of a polling concept like “isvalid” node. is to use event driven, take a look at “Event EndPlay” and “Even Destroyed”. The actor can then call a function to notify that it’s “dieing” and you won’t have to “query” all the time, just wait for the event to fire, and your done.