Download

GetLifetimeReplicatedProps(..) Bug?

So am having this issue where adding


virtual void GetLifetimeReplicatedProps(TArray < class FLifetimeProperty > & OutLifetimeProps) const OVERRIDE;

to my Character class couses problems (PIE/ Standalone crash), and i have a qustion.

If i add the above function decleration to my Character class and add a replicating property for health.


protected:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = Health)
		float Health;

And the defenition



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

	DOREPLIFETIME(AMyProjectPlayerClass, Health);
}

i get a error when starting a network game, “Unable to find property Health in clas …”
I had a look at the shooter game and i noticed its not decleard in the header for AShooterCharacter::.
So is there somthing else i need to do for this function?

In the API Refrence i found GetLifetimeReplicatedProps(…) in UObject::
So am wondering did i miss some crucal information about this function. On how am suposed to override it?

Thanks for any help on the matter.

For anyone experiencing the same issue it was due to after the Project got Refreshed in visual studio.
The UE Build tool had generated the source files outside my folder sturcrures and thus compiling the wrong / old files.
My quik solution to this was update my Visual Studio project to reflect the structure the Editor wanted. :\

And for the GetLifetimeReplicatedProps(…) its not to be decleard in the class header as as i first tought its part of UObject::

You do not need any declaration in header.

I have



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

	// only to local owner: weapon change requests are locally instigated, other clients don't need it
	//DOREPLIFETIME_CONDITION(AInterceptorCharacter, Inventory, COND_OwnerOnly);

	//everyone except local owner: flag change is locally instigated
	DOREPLIFETIME_CONDITION(AAversionInterceptorCharacter, bIsTargeting, COND_SkipOwner);
		DOREPLIFETIME_CONDITION(AAversionInterceptorCharacter, bWantsToRun, COND_SkipOwner);

//	DOREPLIFETIME_CONDITION(AAversionInterceptorCharacter, LastTakeHitInfo, COND_Custom);

	// everyone
	//	DOREPLIFETIME(AInterceptorCharacter, CurrentWeapon);
	DOREPLIFETIME(AAversionInterceptorCharacter, Health);
}


I want to declare this in the subclass of this pawn where I can access Current Weapon and Inventory variables, but the OVERRIDE statement does not compile. Declaring the child class in the header at the top, that these variables are in only crashes PIE, the other replication functions work but override doesnt