STEPS:
- Create a MainMap (This will be the persistent map)
- Create a SubMap (This is added to the persistent map - MainMap)
- Add an input event to the MainMap that will load and set visibility (true) of the “SubMap”
- Create a new BP Actor named A
- Create a new BP Actor named B
- In A’s Event Graph have Event Begin Player call “Get All Actors of Class” and search for class “B”, then print the length of the array.
- Put A and B into the SubMap.
- Run, use the input key to load the SubMap; the result printed out is 0. (But we know the actor exists!)
- Now add a Delay (0.2) node to the beginning of the A’s Event Begin Play (The rest the same as before).
- Run, use the input key to load the SubMap; the result printed out is 1. (It works.)
CAUSE?
I believe the cause is because actors in sublevels have their event begin play run as they are instantiated. This feels like a bug, because shouldn’t all actors be loaded from the sublevel before calling beginplay on the actors within? I feel like behavior should be the same in persistent maps and sub maps at least in this regard.
THE PROBLEM
The delay node fixes it but that means you have 0.2 seconds before your actor initializes, and this means your actor is already ticking. So that means you need to be checking for valids all over the place!
SIDE NOTE
The actor A from the sublevel WILL detect all actors B in the persistent world. But again, this isn’t useful if the actors you need are in the sublevel your loading!