Objective: replicate two variables
I wrote a function as shown in all the documentation:
cpp:
void ANoNameCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(ANoNameCharacter, isRMBpressed);
DOREPLIFETIME(ANoNameCharacter, bShiftDown);
}
Header:
void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
, but when compiling I get these three strange errors:
NoNameCharacter.cpp(110) : error C3875: call of non-static member function missing argument list
NoNameCharacter.cpp(110) : error C2672: ‘UE4Asserts_Private::GetMemberNameCheckedJunk’: no matching overloaded function found
NoNameCharacter.cpp(110) : error C2660: ‘GetReplicatedProperty’: function does not take 2 arguments
Line 110:
DOREPLIFETIME(ANoNameCharacter, isRMBpressed);
Something tells me that the error lies in * ‘UE4Asserts_Private::GetMemberNameCheckedJunk’: no matching overloaded function found*, so I put it in the title of the question.
Edit:
I don’t know what is wrong, but when I commented out line 110, everything compiled, although it is completely identical to line 111…
void ANoNameCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
//DOREPLIFETIME(ANoNameCharacter, isRMBpressed); <-- It compiles without this line, but its the same as the next line!
DOREPLIFETIME(ANoNameCharacter, bShiftDown);
}
Variables declaration:
public:
UPROPERTY(Replicated)
bool bRMBdown = false;
UPROPERTY(Replicated)
bool bShiftDown = false;