getnamo / GlobalEventSystem-Unreal

Loosely coupled internal event system plugin for the Unreal Engine.
MIT License
275 stars 44 forks source link

Cleaning up listeners on PIE session #23

Closed reisandbeans closed 1 year ago

getnamo commented 3 years ago

Interesting approach, I wonder if the begin pie lambda gets called before other e.g. actor begin play calls? If so that small change might be enough. Have you tested this with a bunch of listener adds on begin play?

Tokix commented 1 year ago

Can confirm that this PR is working. Before UE (5.1 in my case) crashed on fast restarts within the editor with multiple listeners. The old references of listeners were not cleaned up propertly as the GESWorldListenerActor which is responsible for the cleanup does not exist right at the beginning it takes some time to spawn. So If the application is closed before this actor exists the listeners do not get cleaned up leading to crashes within the UE-Editor "Play of selected Viewport", because the GES Plugin still keeps this references over the restarts of the game within the UE-Editor. With this version its not crashing and working as expected.

getnamo commented 1 year ago

Thanks for the detailed response. I want to probably refactor some of the logic to use a world subsystem instead, but this is a good backup either way it seems.