In FUObjectAnnotationSparseSearchable::AddAnnotation(), checkSlow(NumExistingRemoved == 0) fails with the following (partial) callstack when serializing a landscape heighfield collision component for play-in-editor:
UE4Editor-CoreUObject-Win64-Debug.dll!FUObjectAnnotationSparseSearchable<FUniqueObjectGuid,1>::AddAnnotation(const UObjectBase * Object, FUniqueObjectGuid Annotation) Line 303 C++
UE4Editor-CoreUObject-Win64-Debug.dll!FLazyObjectPtr::PossiblySerializeObjectGuid(UObject * Object, FArchive & Ar) Line 142 C++
UE4Editor-CoreUObject-Win64-Debug.dll!UObject::Serialize(FArchive & Ar) Line 958 C++
UE4Editor-Engine-Win64-Debug.dll!UActorComponent::Serialize(FArchive & Ar) Line 1627 C++
UE4Editor-Engine-Win64-Debug.dll!USceneComponent::Serialize(FArchive & Ar) Line 1812 C++
UE4Editor-Engine-Win64-Debug.dll!UPrimitiveComponent::Serialize(FArchive & Ar) Line 586 C++
UE4Editor-Landscape-Win64-Debug.dll!ULandscapeHeightfieldCollisionComponent::Serialize(FArchive & Ar) Line 1247 C++
This can be reproduced by loading the attached map LandscapeHolesReduced in a debug configuration, then selecting “Play In Active Viewport.”
The problem is that the GUID serialized to the archive isn’t actually assigned to the duplicated object, and thus doesn’t match later on. I fixed this by changing the following line in FLazyObjectPtr::PossiblySerializeObjectGuid() from this:
Guid = FoundGuid = FGuid::NewGuid();
to this:
FUniqueObjectGuid ObjectGuid = FUniqueObjectGuid::GetOrCreateIDForObject(Object);
Guid = FoundGuid = ObjectGuid.GetGuid();
But it would be nice to have official word as to whether this is the right fix.