Karts don't move and can't activate replication in the GoKart blueprint

After refactoring and building successfully I tried to move the karts, both client and server side, but they didn’t move. The point were I think something could go wrong is where Sam activates Replication in the ReplicationComponent manually. I have open the blueprint but the details of ReplicationComponent are empty:

And the configuration of it being visible at GoKart.h is as expected:

	UPROPERTY(VisibleAnywhere)
	UGoKartMovementReplicator* ReplicationComponent;

Also I have checked that replication is set true as default in the constructor:

UGoKartMovementReplicator::UGoKartMovementReplicator()
{
	// Set this component to be initialized when the game starts, and to be ticked every frame.  You can turn these features
	// off to improve performance if you don't need them.
	PrimaryComponentTick.bCanEverTick = true;

	SetIsReplicated(true);
}

The entire project is uploaded to github so you can check the other files https://github.com/r4ulill0/KrazyKarts

This sometimes happens and the following steps often help. There are 3 basic things you can do to resolve these sort of issues.

  1. Close the editor and open again then test.
  2. Reparent the BP_GOKart to APawn and then back to the UGoKart class. Test Again
  3. if neither works, close again and delete the binaries folder. On launch this will recompile.

Give these a try and let me know how you get on.

1 Like

TL;DR: Reparent to some other class (Actor for example), accept the losing information message, and reparent again to GoKart class fixes the details panel problem. My other problem, the server not moving was because in tick I was comparing ROLE_SimulatedProxy with the local role instead of the remote role.

Closing the editor and re-opened it again didn’t work.

Reparenting (as shown in the image) seems to make it work but only on the client side which is pretty weird. Also, the blueprint details panel is still empty. I tried to re-open the editor but it didn’t work. Finally, I tried to first reparent the BP to another class, Actor in this case, provoking a data loss and after that reparenting to GoKart class to retrieve the original components. After that, the details panel shows but the server-side kart does not move.
image

Isolating the problem I found that in my Tick method in the replication component, I tried to use GetLocalRole instead of GetRemoteRole to check the SimulatedProxy so it never ended inside there because it was impossible for a local role being two roles at the same time. This came out because I used IsLocallyControlled() in previous lessons instead of GetRemoteRole(). I had to change it because GetOwner() gives you an Actor and IsLocallyControlled() is a Pawn method (this could be fixed in many ways but the details panel problem made the problem harder to pinpoint).

1 Like

Glad you got it sorted Raulillo.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.