Blueprint Components & Replication

4.7 preview 7.
Created a blueprint (actor) component with various variables, all are set to replicated, also the component itself.
Added component to Playercontroller, called an event in the component (Run on Server) which sets some variables to their correct values. During that processing i call a multicast event for spawning some effects which rely on some of the variables being replicated; These still are set to none, while having the correct value on the server.

If, instead of setting the variable and letting it replicate, a multicast event with one var as is called, which is then used to set the variable on all clients, everything works correctly.

Update: here a simplified setup in the screenshot for the server and the multicast function (multicast set to reliable since it wont do otherwise).

When i call Server_Execute from my PlayerController i then get the following Output:
Server: true
Client1: false
Client2: false

Cheers,

Hello ,

I was unable to reproduce this issue on our end. I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. Could you show the blueprint that is firing off the Server_Execute custom event node?
  2. Can you reproduce this in a clean project?
  3. The screen shots are very helpful, however if you can reproduce this in a clean project, could you provide a detail list of steps to reproduce this on our end?

Hi Rudy,

even better, i attached a sample project consisting of:

  1. A custom GameMode (to have a custom playercharacter and controller)
  2. the BP_Testcomponent with the 2 calls and a replicated var in there
  3. a BP_Controller which calls the Server function inside the component on Left mouse click
  4. a BP_Character which calls the Server function inside the component on Right mouse click

So if you open the project and click on play (at least 2 players) you should see with a left - or right - mouseclick the messages
Server: true
Client1: false

So the variable is not replicating (as it has the value “true” on the server and “false” on the client(s)).

Cheers,

link text

Hello ,

I was able to reproduce this issue with the project provided. I have written up a report (UE-10013) and I have submitted it to the developers for further consideration. I will provide updates with any pertinent information as it becomes available. Thank you for your information and time.

Make it a great day

Hi Rudy,

Is this still broken/can we have an update? I’m still observing that blueprint replication of variables does not work. This is almost two months since this question was first asked, and its a pretty serious bug (for example, I have a multiplayer blueprint driven game that is currently completely broken by this replicating issue). Is the bug fixed on the c++ source? When can we expect a fix on the engine downloaded/compiled by the launcher?

Many thanks,

Hello ElliotB,

I went ahead and double checked the status of this issue. However, the status has not be changed to fixed as of yet. This issue is on the developers to do list and I will be sure to bump the community interest for this issue.

Thanks for the update Rudy! Is there something like a trello/ticket we can view for this issue incase we find anything else to add?

Facing the same problem. Quite annoying as i use a modular design, based on scene components - project is currently on HALT because of that

Hello lugit,

I went ahead and double checked the status of this issue. However, the status has not be changed to fixed as of yet. This issue is on the developers to do list and I will be sure to bump the community interest for this issue.

The issue is, that ActorComponent::GetLifetimeReplicatedProps does not include the variables generated in the blueprint. A workaround is to subclass ActorComponent with a component (NetworkActorComponent) that does include those variables. You can then reparent your class to the new component.

I only made a small test, so I don’t know if this works for you, but I hope it helps.

NetworkActorComponent.h

#pragma once

#include "NetworkActorComponent.generated.h"

UCLASS(Blueprintable, BlueprintType, meta = (BlueprintSpawnableComponent), Abstract)
class [PROJECT_API] UNetworkActorComponent : public UActorComponent
{
	GENERATED_BODY()

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

NetworkActorComponent.cpp

#include "[ProjectPCH].h"
#include "NetworkActorComponent.h"

// This function is copied from ActorReplication.GetLifetimeBlueprintReplicationList, only the class of the first parameter changed
// The first parameter may event not be needed
static void GetLifetimeBlueprintActorComponentReplicationList(const UActorComponent* ThisActorComponent, const UBlueprintGeneratedClass* MyClass, TArray< FLifetimeProperty > & OutLifetimeProps)
{
	if (MyClass == NULL)
	{
		return;
	}
	uint32 PropertiesLeft = MyClass->NumReplicatedProperties;

	for (TFieldIterator<UProperty> It(MyClass, EFieldIteratorFlags::ExcludeSuper); It && PropertiesLeft > 0; ++It)
	{
		UProperty * Prop = *It;
		if (Prop != NULL && Prop->GetPropertyFlags() & CPF_Net)
		{
			PropertiesLeft--;
			OutLifetimeProps.Add(FLifetimeProperty(Prop->RepIndex));
		}
	}

	return GetLifetimeBlueprintActorComponentReplicationList(ThisActorComponent, Cast< UBlueprintGeneratedClass >(MyClass->GetSuperStruct()), OutLifetimeProps);
}

void UNetworkActorComponent::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
	Super::GetLifetimeReplicatedProps(OutLifetimeProps);
	GetLifetimeBlueprintActorComponentReplicationList(this, Cast< UBlueprintGeneratedClass >(GetClass()), OutLifetimeProps);
}

Any update? Like Lugit I have a modular design based on scene components and cannot make progress because of this flaw.

I have to say I am suprised this issue has not been fixed faster. Am I using a branch that is considered ‘unstable’? I have serious concerns about using ue4 in future projects given that such a core functionality can be so badly broken and remain that way for such a long time.

Hello ElliotB,

There is not a definite time frame in place for this issue at this time. The status has not be changed to fixed as of yet. I would suggest looking through the next set of release notes for the jira number (UE-10013) that was provided above.

Hey,

this PR should fix the issue:

There is also a solution that does not require modifying the engine source code. Did you have a look at the answer I posted?