In my game, Character has a set of spells which I used a Tarray to store it and replicate it to all clients. And I did TArray replication just like the ShooterGame. But the TArray member only replicates the size of the array, excluding the spells.
And After reading some similiar question on AnswerHud, I found someone solved it by “spell->SetReplicates(true);” after spawn the spell. But in my case, it still doesn’t work!
Sorry to revive this old thread, but I’m facing a very similar issue - I’m spawning some Actors on the server, adding them to a replicated TArray, but I only end up with a (correctly sized) TArray full of NULLs on the client.
I’ve tried all the stuff mentioned here, including SetOwner(), bReplicates = true and actor->SetReplicates(true), but nothing works.
One difference, though, is that this TArray resides on my AGameState implementation (instead of, let’s say, a replicated in-game character). Would this be an issue? Mind you, every other replicated variable in my AGameState replicates correctly - it’s just this TArray that’s misbehaving;
Solved it. What I forgot was that my replicated Actors in the TArray also have associated Blueprints. They started replicating correctly after I ticked the “Always Relevant” checkbox.
I guess this was needed because this TArray is really being used as a data container (spawned at origin and never moved, with the GameState as its owner instead of a Character/Pawn) and so was deemed as “not relevant” on the client.