Does pawns get automatically killed?
So i´m experiencing some strange behavior that is breaking my head...
I have a grenade, which has a name. I save an instance of this grenade into a variable that is never modified/used/deleted/throwed or anything, also I have a user widget which shows on screen grenade name from this particular variable.
What is happening: After random amount of seconds (I chronometed this, always above 1 minute) this particular instance throws this error "Attempted to access GrenadeInstance but is pending kill"...
At beginning I thought It was because some mistake on my code, where I throw grenades... but no, If I press play, and keep everything still, it happens the same, so this looks like a garbage collector feature here, also Im sure im not using LifeSpan, there is no reference to lifeSpan, besides as I said, it is randomly being killed.
Is there something that unreal does to automatically kill this kind of pawns? If so, is there a way to prevent this to happen?
asked Feb 10 '19 at 07:42 PM in Using UE4
Pawns will only be destroyed if they are unpossessed, manually destroyed with code (DestroyActor) or they have fallen out of the world.
One way you could test this is by moving your grenade variable to the player controller, if the error persists, then it is a problem with your logic.
When you say you "save an instance of this grenade to a variable". How are you actually setting that reference?
answered Mar 21 '19 at 10:19 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here