Download

Multiplayer sync to server problem

class UIKBodyComponent : public UActorComponent
{
UPROPERTY(EditAnywhere, Replicated, Category = “IKBody”)
FVector BodyCurrentLocation = FVector();
}

void UIKBodyComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{…
USkeletalMeshComponent* Body->SetWorldLocation(BodyCurrentLocation);
…}

i SetWorldLocation in TickComponent, now found the location is not update in other player’s view while multiplayer, seems also not update in server. Using DedicatedServer from unreal tutorial.

Perhaps you are missing the GetLifetimeReplicatedProps function?

void UIKBodyComponent::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
	Super::GetLifetimeReplicatedProps(OutLifetimeProps);

	DOREPLIFETIME(UIKBodyComponent, BodyCurrentLocation);
}