Hello everyone,
I just want to know your opinion about to replicate something like 10 variables.
Is better to put them on a structure or add lot of variables all replicated directly in the actor ?
Thank you,
Have a nice day/night
Hello everyone,
I just want to know your opinion about to replicate something like 10 variables.
Is better to put them on a structure or add lot of variables all replicated directly in the actor ?
Thank you,
Have a nice day/night
In terms of replication, the cost should be about the same. Unreal is usually smart and only replicates what has changed regardless of whether its in a struct or not.
I wouldnât worry too much about these problems, rather I would more consider if the variables should be grouped in a struct for gameplay purposes.
Similar post: Replicating Structs with Properties - Programming & Scripting / Multiplayer & Networking - Epic Developer Community Forums
Thank you for your answer.
I already see that post. My question is more about is it âheavierâ for the game. But if unreal only replicate variable changed itâs perfect for me.
Now about the project I would say yes, itâs better for me to store value inside a structure cause I have 2 complex pawn :S
Use a struct if the elements are related to the same thing.
With structs the first replication is the entire struct and its current element values. Subsequent updates only send values for elements that have changed.
Both struct and independent variables have roughly the same âweightâ. Slightly larger on struct do to its structure⌠variables in a variable. The individual types will match up byte/bit to byte/bit.
Working with structs is more complex, requires more code to update/set. This will add weight to the class itself.