TL;DR- Replicated Component works on Character, but not Pawn?
I’m struggling to get Clients to update their HUD’s based on a component on their Pawns, called ‘GameObjectComponent’.
What’s strange is that the Component exists on the Clients and is set to replicated, and created and set-up exactly the same way on my custom Vehicle (Pawn) class as it is on my Character class. Characters have no problem reading the replicated value in the Game Object Actor Component, and the HUD can access the values just fine.
The vehicle however can’t, and I can’t work out how to make the Vehicle ensure that the GameObject component replicates. Both constructors use the following identical code:
Constructor
GameObjectData = ObjectInitializer.CreateDefaultSubobject<UBZGame_GameObjectComponent>(this, TEXT("GameObjectComp"));
GetGameObjectComponent()->SetUpdatedMeshes(GetMesh1P(), GetMesh());
GetGameObjectComponent()->SetNetAddressable();
GetGameObjectComponent()->SetIsReplicated(true);
Is there another flag I have to set in my Pawn to make it replicate this component, and do sub-classes automatically inherit the same properties for Component Replication?
EDIT:
Okay… it’s now kind of working and I changed nothing… what gives?
EDIT #2: Issue appears to be one of Pawn/Possession Replication, see here: Spawning a Pawn and Possess()'ing it doesn't function properly in MP with replication - Programming & Scripting - Unreal Engine Forums