My friend said that if he destroy the Ability Owner or Avatar before the Gameplay Ability ends, game can crash.
A simple solution is to add a Delay(0) before destroying the Actor so that the destruction operation is delayed until the next frame.
However, when I tried to destroy the Ability Owner, I found that even without Delay(0), the game didn’t crash, and everything worked fine. Is this related to the version of Unreal? My version is 5.4.4, my friend is using 5.3.
Additional questions:
- What is the underlying logic of this crash problem and solution?
- I tried destroying the Actor in “Event on End Ability”, but this causes the frame rate to plummet, and if multiple Actors are destroyed at the same time, the framerate drops to almost 0. However, when my friend destroys the actor in this way, the game still crashes, what’s going on?
Thanks a lot to the techies who can answer my question!