Replicating Animation Variables

Hello everyone. I’m currently working on a multiplayer game that contains a bunch of interactable objects. These objects can put the player into many different kinds of animation blueprints, each with their own sets of variables. Since these animations need to be synced across all clients (including those who are joining in the middle of a game), I want to be able to easily set animation variables on the server, and have those changes replicated onto each client. The problem is that UAnimInstances do not replicate, since they’re not actors. I’m not sure I can have the player actor hold the variables, since those variables can come in any combination of types. I also considered having a replicated actor class that contains copies of the variables, but then I would have to create a class like this for every animation blueprint, which is undesirable. I’m pretty stuck, and I was wondering if anyone had any good ways to do this.

Thanks everyone in advance!

Are you sure you couldn’t get away with just replicating montages instead?

1 Like

This seems good. What if the animation content you play is an animation state machine. I assume this could be wrapped in a montage, with the trigger variables in the custom anim type, but would those trigger variables replicate when their values change?

Look into animation notifiers and branch points.
It won’t solve the replication of values, but it does let you change animations etc based on variables.
e.g. Start at A, change to C mid way through if X, else continue to B.
In C, change to B mid way through if Y, else loop C.

The X & Y variables could come from the server, provided you allow for replication time.