Commit 78646ac8 authored by Carl Findahl's avatar Carl Findahl 💬
Browse files

Fix lever not working on client

parent e4630540
......@@ -2,9 +2,16 @@
#include "InteractableActor.h"
#include "UnrealNetwork.h"
// Sets default values
AInteractableActor::AInteractableActor()
{
PrimaryActorTick.bCanEverTick = false;
SetReplicates(true);
}
void AInteractableActor::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const {
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(AInteractableActor, bActivated);
}
......@@ -35,8 +35,10 @@ public:
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Interaction")
const bool IsActivated() const { return bActivated; }
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
protected:
/** Is the item activated */
UPROPERTY(BlueprintReadWrite, Category = "Interaction")
UPROPERTY(BlueprintReadWrite, Category = "Interaction", Replicated)
bool bActivated = false;
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment