Hi,
I created in c++ a new type for use in blueprints. The type works and it behaves correctly.
Hovever, when I set on the blueprint that variable as replicated, it is not.
I have tested and if I create a variable of a different type with the same setup, it is replicated, so I assume is something wrong with my type definition.
In terms of the class definition (EDITED)
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "Object.h"
#include "Order.h"
#include "UnrealNetwork.h"
#include "MasterGruntC.h"
#include "Plan.generated.h"
/**
*
*/
UCLASS(BlueprintType, Blueprintable)
class THESIS_API UPlan : public UObject
{
GENERATED_BODY()
public:
UPROPERTY(Replicated)
bool bcanContinue;
UPROPERTY(Replicated)
TArray < UOrder*> orders;
UPROPERTY(Replicated)
TArray < AMasterGruntC*> soldiers;
UPROPERTY(Replicated)
FString planName;
UPROPERTY(Replicated)
int planPhase;
UPlan(FString newPlanName);
UPlan();
//Plan Maintenance
UFUNCTION(BlueprintCallable, Category = "Plan")
void changeName(FString newName);
UFUNCTION(BlueprintCallable, Category = "Plan")
void resetPlan();
//Orders
UFUNCTION(BlueprintCallable, Category = "Plan")
bool executeNextOrder();
UFUNCTION(BlueprintCallable, Category = "Plan")
void addOrder(UOrder* newOrder);
UFUNCTION(BlueprintCallable, Category = "Plan")
FText showOrders();
UFUNCTION(BlueprintCallable, Category = "Plan")
void removeOrder(int index);
//Soldiers
UFUNCTION(BlueprintCallable, Category = "Plan")
void addNewSoldier(AMasterGruntC* newSoldier);
UFUNCTION(BlueprintCallable, Category = "Plan")
void removeSoldier(int index);
UFUNCTION(BlueprintCallable, Category = "Plan")
void listSoldiers();
UFUNCTION(BlueprintCallable, Category = "Plan")
bool checkIfSoldiersReady();
//Replication
void GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const;
};
And the override
void UPlan::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const {
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(UPlan, bcanContinue);
DOREPLIFETIME(UPlan, orders);
DOREPLIFETIME(UPlan, soldiers);
DOREPLIFETIME(UPlan, planName);
DOREPLIFETIME(UPlan, planPhase);
}
And the blueprint setup, where repTest is changed but plan is not.
Finally the var definition on blueprint:
Variables: