4.24 Possession issue


Ever since 4.24 came out I was having random issues in my long running project and it took me a while to get around to figure out what is wrong.

Long story short I like to set owner on Spawn Actor to something that makes sense to own the Actor, sadly then if I Possess it with AI controller things break.

I tracked the issue down to a change that was merged into 4.24. This change automatically sets Owner to the Controller that Possesses the Actor, which makes sense in probably most cases except in the particular case where you explicitly specify the Owner.

As a result of this I decided to add on top of the change that got merged and only set the Owner if there is no Owner already present. I understand there is an edge case where you might want to change the Owner on possession but I think that in those cases you should explicitly change the owner.

The change I am proposing is available here https://github.com/EpicGames/UnrealEngine/pull/6576 and should be fine in preserving any functioning code that has been created before 4.24 and if you rely on the automatic assigning of Owner on possession it should still satisfy your needs.

Sorry to promote my change this way, this is a post both to promote the fix and to post the issue somewhere as it caught me by surprise.