I don’t think that I’ve written original question precisely enough so I’ll post some example code.
TestActor.h
#pragma once
#include "GameFramework/Actor.h"
#include "TestActor.generated.h"
UCLASS()
class TESTPROJECT_API ATestActor : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ATestActor();
// Something Something GetLifetimeReplicatedProps, this is not a commented out function declaration
// The above comment stops file from compiling, if the "GetLifetimeReplicatedProps" string is removed (or broken with space/underscore etc.)from this and the above comment the file can now compile
UPROPERTY(Replicated)
int32 MyReplicatedInt;
};
TestActor.cpp
#include "TestProject.h"
#include "TestActor.h"
#include "UnrealNetwork.h"
// Sets default values
ATestActor::ATestActor()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
SetReplicates(true);
bAlwaysRelevant = true;
}
// Implementation of replication function, since i want to have more control over what's getting replicated to who
void ATestActor::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const
{
DOREPLIFETIME(ATestActor, MyReplicatedInt);
}
The issue is not with the commenting out function declaration.