Video is outdated in how to enable replication

This video is a bit outdated, as you can now set replication to enabled on the constructor by using

{
	PrimaryActorTick.bCanEverTick = true;

	// The new way
    bReplicates = true;
	SetReplicatingMovement(true);

	SetMobility(EComponentMobility::Movable);
}

void AMovingPlatform::BeginPlay()
{
	Super::BeginPlay();

    // The old way now commented out

	// if (HasAuthority())
    // {
	//     SetReplicates(true);
	//     SetReplicateMovement(true);
	// }
}
1 Like

Is it not necessary to check the Authority first to filter server from client anymore?

I think it probably doesn’t matter if they are set client side.

I tried it this way and couldn’t get the cube to move, the old way worked for me tho…

I think is not needed to use the Authority because I tried to put the code lines without the if to check the error and it worked perfectly.

At least in Unreal 5

For those that may be having issues in UE5 getting the cube on the client to move after switching to the method recommended by OP, you may need to close the editor and build the project directly in visual studio (i.e. ctrl+shift+b → <project_name> Development Build). After doing this, the cube on the client side began working for me.

Updating constructors in C++ classes can sometimes have strange effects when using live coding because the constructor may not be called again after the component has already been placed.

Just disable live coding. It’s still not a production ready feature even though it isn’t marked as beta. It causes so many issues.

Privacy & Terms