Pending Kill Issue

After my character dies, i destroy the actor. Now i am getting an error “attempted to access third personCharacter via property Player Ref but ThirdPersonCharacter is pending kill”. Image 1 is where the error is occuring.

Image two is my ThirdpersonCharacter blueprint where the player self property is set.

Image three is my level blueprint where the character dies and then the actor is destroyed.

Any help would be great thank you!

Well, you do not remove the HUD when you destroy the player. I assume you call GetPlayerHealthPercent every tick? You could do one of the following (there are probably tons of other ways to do this):

  • remove the HUD widget first
  • set PlayerRef to None and add a check if it is set
  • add a bool “PlayerDead” to the HUD, set to true on death, and check that every frame
  • not destroy the player character, but hide it instead

Thanks! I added set actor to hidden instead of destroy and that works!