Do you destroy the actor when setting the IsDead bool? I might be wrong, but I think since the actor is still referenced in memory until it’s cleared by the garbage collector, it’s still valid, but it’s Pending Kill, so it’s no longer accessible.
Thats the point, if i detach the controller, why the controlled pawn reference is passing through IsValid? By the way even if i dont use the Detach node i still have the error.
I’ve checked it. After detaching from controller, Get Controlled Pawn seem to continue returning something that passed validation, but you can’t get any data from it.
Maybe you should find another way to do what you need, e.g. with death events.
Ok , so before detaching and destroying the actor i destroyed the AIPerception component on controller sinse the event “On Target Perception Updated” of this component is the initial cause of the error. My idea is to prevent the component to fire the event when the actor is dead. But i dont know why, the event is still firing even after destroying the component.