I have a pawn for a “vehicle crew member” with AbilitySystemComponent, containing such attributes as health, shield, etc. However, I want it only to be replicated when it’s possessed by a player controller, otherwise I want it not to use network bandwith, because for example there are 10 crew positions on 1 vehicle and 5 vehicles on the battlefield, and why replicate them when their crew members are out and can’t be damaged, use abilities, etc.
I have a function responsible for spawning a mesh of the crew pawn, cosmetics and restoring full health when a player enters vehicle and possesses a crew pawn or removing all this when it unpossessed a pawn (I call this function on “Receive Controller Changed”). I want to use “AbilitySystemComponent->SetIsReplicated(bIsReplicated)” in the end of this function to achieve my goal, will it be a good solution?
I wonder what happens if component isn’t replicated, do current clients always receive the latest state of component replicated variables before replication was turned off and what about new client that just joined while replication was turned off (guess they will just get constructor values)? It doesn’t matter for now, as I don’t show any healthbar for this pawn or anything related to its GAS and only care about replication related to abilities from/to owning client.