Hi,
There is a problem with variable replication in level blueprints that causes level Actor references to be invalid after level unload/load. Our bypass of the problem is to not use Replication on Level Blueprint Variables.
Here are steps to reproduce it:
- Load a Level MyMap_S with a Level Blueprint which has variable Variable_Name that has Replication set (to Replicated).
- Connect with a client.
- Unload level MyMap_S with that BP. → Replication system keeps references to Variable_Name and keeps a BP from unloading.
- Load level MyMap_S again. → FLinkerLoad::CreateExport() loads a level BP from memory and FLinkerLoad::RegenerateBlueprintClass() isn’t being called.
- All Actor reference pointers are stale
“Obj Refs Name=MyMap_S_C” lists number of reference paths going through network code and Variable_Name to level blueprint:
[...]
[2092.23][824]LogReferenceChain: IpConnection /Engine/Transient.IpConnection_1->Driver
[2092.23][824]LogReferenceChain: IpNetDriver /Engine/Transient.IpNetDriver_2->UE4Editor-Engine.dll!UNetDriver::AddReferencedObjects() [f:\perforce2\ue4-main\engine\source\runtime\engine\private\networkdriver.cpp:2174]
[2093.38][824]LogReferenceChain: BoolProperty /Game/Maps/MyMap_S.MyMap_S_C:Variable_Name!->Outer
[2093.39][824]LogReferenceChain: (target) BlueprintGeneratedClass /Game/Maps/MyMap_S.MyMap_S_C
If it’s not forbidden to use replication on level blueprint variables, and it’s not blocked, it seems like a bug in UE4 4.16.
best,
Klaudiusz