Crash On Play - Exception Access Violation - Replicating Properties?

Hey all,

I keep running into a crash whenever I try playing my project on Client.

See error message below. It appears its something to do with replicating variables or sub-objects in the game. I’m not sure where my code goes wrong however.

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000001600000007

UnrealEditor_Engine!UPackageMapClient::SerializeObject() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\PackageMapClient.cpp:229]
UnrealEditor_CoreUObject!FObjectPropertyBase::NetSerializeItem() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\PropertyBaseObject.cpp:123]
UnrealEditor_Engine!FRepLayout::SendProperties_r() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\RepLayout.cpp:2800]
UnrealEditor_Engine!FRepLayout::SendProperties_r() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\RepLayout.cpp:2703]
UnrealEditor_Engine!FRepLayout::SendProperties() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\RepLayout.cpp:2863]
UnrealEditor_Engine!FRepLayout::ReplicateProperties() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\RepLayout.cpp:2067]
UnrealEditor_Engine!FObjectReplicator::ReplicateProperties_r() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\DataReplication.cpp:1786]
UnrealEditor_Engine!FObjectReplicator::ReplicateProperties() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\DataReplication.cpp:1727]
UnrealEditor_Engine!UActorChannel::ReplicateSubobject() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\DataChannel.cpp:4401]
UnrealEditor_Engine!AActor::ReplicateSubobjects() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\ActorReplication.cpp:457]
UnrealEditor_Engine!UActorChannel::ReplicateActor() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\DataChannel.cpp:3253]
UnrealEditor_Engine!UNetDriver::ServerReplicateActors_ProcessPrioritizedActors() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\NetDriver.cpp:4733]
UnrealEditor_Engine!UNetDriver::ServerReplicateActors() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\NetDriver.cpp:5175]
UnrealEditor_Engine!UNetDriver::TickFlush() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\NetDriver.cpp:705]
UnrealEditor_Engine!TBaseUObjectMethodDelegateInstance<0,UNetDriver,void __cdecl(float),FDefaultDelegateUserPolicy>::ExecuteIfSafe() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:611]
UnrealEditor_Engine!TMulticastDelegate<void __cdecl(float),FDefaultDelegateUserPolicy>::Broadcast() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateSignatureImpl.inl:967]
UnrealEditor_Engine!UWorld::Tick() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:1695]
UnrealEditor_UnrealEd!UEditorEngine::Tick() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\EditorEngine.cpp:1777]
UnrealEditor_UnrealEd!UUnrealEdEngine::Tick() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\UnrealEdEngine.cpp:474]
UnrealEditor!FEngineLoop::Tick() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:5215]
UnrealEditor!GuardedMain() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:183]
UnrealEditor!GuardedMainWrapper() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:147]
UnrealEditor!LaunchWindowsStartup() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:283]
UnrealEditor!WinMain() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:330]
UnrealEditor!__scrt_common_main_seh() [d:\a01\_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

I’d appreciate any help to narrowing down what is going wrong in my code.

Thank you!

Through the process of elimination, I managed to narrow it down to the problem - a struct I made that I resized at Begin Play.

The Struct:

USTRUCT(BlueprintType)
struct FEquipmentMeshData
{
	GENERATED_BODY()

	UPROPERTY(BlueprintReadWrite, EditAnywhere)
		EEquipmentType EquipmentSlot;

	UPROPERTY(BlueprintReadWrite, EditAnywhere)
		UMeshComponent* MeshComponent;

	UPROPERTY(BlueprintReadWrite, EditAnywhere)
		FName TargetSocketName;

	UPROPERTY(BlueprintReadWrite, EditAnywhere)
		USkeletalMesh* DefaultSkin;
};

The declaration of the struct in my class:

UPROPERTY(Replicated, BlueprintReadWrite, Category = "User Interface")
	TArray<FEquipmentMeshData> EquipmentMeshData;

The code that seems to throw up this error:

EquipmentMeshData.SetNum(5);

I’m not sure how this causes a crash. Would anyone be able to shed light on this?

Thanks!