The first time I compiled and ran the project It was okay, but after 2nd compilation it has denied to compile it again.
AFAIK GetLifetimeReplicatedProps can be used w/o override construction. and for DOREPLIFETIME I has included
in the top(you can see it in my code down below)
I am having the problem with GetLifetimeReplicatedProps it says:
I have already done this before in another project and it was okay.
But this time it does not. I tried to override it and it starts working, but I think that is not correct.
I tired to fix this w/o overriding by doing next steps:
- Clear Solution
- Rebuild Project
- RMB generate VS project files
- Reopen the VS2017 and UE4
MY Setup:
UE ver: UE4 4.23 (using laucher)
VS: VS2017 Pro 15.9.3
SCharacter.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "SCharacter.generated.h"
class UCameraComponent;
class USpringArmComponent;
class ACustomProjectile;
class ASWeapon;
class USHealthComponent;
UCLASS()
class COOPGAME_API ASCharacter : public ACharacter
{
GENERATED_BODY()
public:
// Sets default values for this character's properties
ASCharacter();
protected:
UPROPERTY(Replicated)
ASWeapon* CurrentWeapon;
};
SCharacter.cpp
void ASCharacter::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(ASCharacter, CurrentWeapon);
}
Output log in VS
Thank you for you attention!