Simulated gameplay tasks are not replicating to clients

Hello,

in this function, the check is if(!RepFlags->bNetOwner) which resulted in simulated gameplay tasks from the server not replicated to the clients.

I’m still playing around with the gameplay task system, so I’m not sure if this is a bug, or I’m just misunderstanding what the bSimulatedTask means under UGameplayTask object.

bool UGameplayTasksComponent::ReplicateSubobjects(UActorChannel* Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags)
{
	bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);
	
	if (!RepFlags->bNetOwner)
	{
		for (UGameplayTask* SimulatedTask : SimulatedTasks)
		{
			if (SimulatedTask && !SimulatedTask->IsPendingKill())
			{
				WroteSomething |= Channel->ReplicateSubobject(SimulatedTask, *Bunch, *RepFlags);
			}
		}
	}

	return WroteSomething;
}

Thank you!

Hey polytopey,

Are you experiencing an issue in terms of functionality with this code? If so, could you describe what you’re seeing that isn’t functioning as you’d expect?

Thanks

Well, like I wrote, I instantiate a class derived from UGameplayTask, set its bSimulatedTask to true in the constructor, but the object doesn’t get replicated to clients because of that check if(!RepFlags->bNetOwner)

I put a breakpoint there, it’s always true on the server.

So my question was, is my understanding correct that if bSimulatedTask is true on the server, then I should expect the gameplay task to be replicated to clients ? That’s not the case currently.

Thanks!

Hey polytopey,

We’ve spent a great deal of time working on reproducing the issue you’re experiencing, but we haven’t been able to do so. Would you be able to provide a simplified test project that showcases the issue, or a detailed list of repro steps?

If you have a project you can PM me a link to dropbox or google drive: https://forums.unrealengine.com/member.php?160394-Sean-Flint

Hello,

I am marking this topic as resolved for tracking purposes, as we have not heard from you in a few days. If this issue persists, feel free to respond to this thread. For any new issues, please create a new Answerhub topic.

Have a great day