I’m trying to make functional in C ++, which allows you to shift while keeping the use of the energy of the character, and is released when - to restore. This happens at the server is replicated and variable. So after clicking on the shift occurs second delay. When I do through the Blueprint, then there is no delay. Please tell me how to reduce delay?
Can you show the C++ you are using to replicate the variable and how you are measuring a 1 second delay? A 1 second delay is not normal. The C++ delay should not be higher than the blueprint delay.
I do not measure it, I’m talking about.
UPROPERTY(Replicated)
float Stamina = 100.f;
void UHealthStats::GetLifetimeReplicatedProps(TArray<FLifetimeProperty> &OutLifetimeProps) const
{
DOREPLIFETIME(UHealthStats, Health);
DOREPLIFETIME(UHealthStats, Stamina);
DOREPLIFETIME(UHealthStats, Thirst);
DOREPLIFETIME(UHealthStats, Hunger);
}
Stamina = FMath::FInterpConstantTo(Stamina, bUseStamina ? 0.f : 100.f, GetWorld()->GetDeltaSeconds(), speed);
The problem was connected with PlayerState: in it the default delay of 1 second.