BeginPlay is called every time a sub-map is made visible

lordmatthoffman
Mon, 21 Aug 2017 06:09:01 +0000
World Creation

Hi all,

It appears that in 4.17.1 (and maybe earlier? Untested) that BeginPlay gets called on all actors in a ULevel every time it is made visible. I do not know if this happens using normal sub-levels or not, but when using the LoadLevelInstance blueprint node it does.

If you store a reference to the streaming level returned by LoadLevelInstance and toggle it’s visiblity off and then back on again it will call BeginPlay on all actors contained by that level instance. They do not get unloaded/reloaded as their state stays the same, so toggling visibility just calls BeginPlay.

The exact replication case I have is below, the Client Load Menu function is called once via the GameMode’s PostLogin via RPC, and then the Set Visible is called, toggling the sub-level on and then off and then on again (not shown). Each time the streaming instance becomes visible again it calls BeginPlay.

I do not use standard sub-levels (ie: levels added as children of the Persistent Map), and I do not use streaming volumes. This is just a standalone map A creating an instance of standalone map B and changing the visibility of that.

This happens in both the editor and builds. Unreal 4.17.1, Launcher.

4 posts - 1 participant