Hi everyone,
I’m working on a multiplayer project in Unreal Engine 5 and I’m having some issues with replicating a custom Actor Component. I’ve created a custom component (in C++) that handles some gameplay logic (like inventory, stamina, etc.), and it’s attached to my character class.
I’ve already set SetIsReplicatedByDefault(true) in the component’s constructor and made sure the owning actor is replicated. However, the variables inside the component are not syncing correctly between server and client. I’ve tried marking them with UPROPERTY(Replicated) and implemented GetLifetimeReplicatedProps, but it still doesn’t work as expected.
My questions are:
-
Is there anything specific I need to do to replicate a custom component properly?
-
Do components need to be registered or initialized in a special way to support replication in multiplayer?
-
Are there common pitfalls or best practices when replicating data inside components?
Any help or pointers would be greatly appreciated. Thanks!