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).
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:
Could you show the blueprint that is firing off the Server_Execute custom event node?
Can you reproduce this in a clean project?
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?
even better, i attached a sample project consisting of:
A custom GameMode (to have a custom playercharacter and controller)
the BP_Testcomponent with the 2 calls and a replicated var in there
a BP_Controller which calls the Server function inside the component on Left mouse click
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)).
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.
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?
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.
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.
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.