CPP RepNotify and Delegate, bind via Blueprint, won´t call..

Hi there…

So… this is my first time dealing with RepNotify and Delegates in Cpp.

Firstly…
This is my binding for the Delegate in my PlayerController:
01
Inventory_Items is an ActorComponent, that is written in Cpp, holding my Inventory System.

The Event “Client_UpdateInventoryUI” is an RPC RunOnOwningClient, that simply takes all opened or hidden Inventory Widgets and updates their Grids via a ForEach Loop of the UI Ref Array (and fires a print String at Completion - Important for the problem…).

To the Code Part _>
the Header

#include "Net/UnrealNetwork.h"
#include....
[...]
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FUpdateContent);
[....]
class THEGAMENAME... UAC_InventorySystem
[...]
public:
	UPROPERTY(BlueprintAssignable, Category="BDC Inventory")
	FUpdateContent OnContentUpdate;

private:
	UPROPERTY(ReplicatedUsing=OnRep_SelfContent, EditAnywhere, BlueprintGetter=GetContent, Category="Inventory Setup")
	TArray<FStruct_InvContent> SelfContent;

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

And the CPP

#include...
[...]


void UAC_InventorySystem::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
	Super::GetLifetimeReplicatedProps(OutLifetimeProps);
	DOREPLIFETIME(UAC_InventorySystem, SelfContent);
}

void UAC_InventorySystem::OnRep_SelfContent()
{
	OnContentUpdate.Broadcast();
}

The Component is replicating and auto activated…

I don´t know, what is not firing… the OnRep_ or the broadcast of the delegate… but I see no print String from the UI Update Event…

Can someone lead me into the right direction?

does UAC_InventorySystem have replication on in it’s CDO?

UAC_InventorySystem::UAC_InventorySystem
{
SetIsReplicated(true);
}

yes, it has.

As a workaround for now… i broadcast the delegate every function call, that changes the inventory content… until the OnRep Function works…

I´ve watched a few more tuts on that topic now… and can´t see a mistake…

Add some UE_LOG and/or print strings to figure this out.

Calling a client RPC from the event seems redundant. RepNotify events are already triggered on client.

Can’t really tell what’s wrong from the screenshots, but I’m a bit suspicious about that replicated “Inventory Items” variable. Actor components shouldn’t have to be held in a replicated variable. Is it a component of the player controller, or something else ? Where are you doing the binding, is it Begin Play ?

Inventory_Items is an ActorComponent addd to the PC, just renamed.

I don’t know why its working now…
but…
after removing and adding the ActorComponent to PC again… its working… just out of nowhere… changed nothing…
just deleted the AC and added it again… :person_shrugging:t2: