After I respawn my character I keep getting a pending kill error for some reason and the functions in my player controller wont work. It sets a ref to the player by casting to it on begin play, but when It gets respawned it seems it cant get the new ref actor, and keeps having this pending kill issue.
My respawn script spawns a new actor of the same type, destroys the other, then possess the new.
Ive been struggling on this for days so I appreciate any help.
You need to refresh the actor reference after respawn; your variable still references the destroyed actor, not the newly spawned.
Sorry to revive an old topic, but how does one go about doing this? I’m having an extremely similar problem to OP and haven’t been able to figure out the fix yet.
In your controller class, there’s must a variable referencing your character, which you use to send all the commands to. So when you possess a new character, you need to set the value of that variable to the new character, or else you’re trying to control the old character actor that’s being destroyed.
If you can possess a new character, then you already can get a reference to it. All you need to do is put this reference to the variable you’re using to control it.