Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Problems getting variable to replicate in animation blueprint

So I have a character controller where I'm grabbing the Axis value of InputAxis MoveForward and InputAxis MoveRight and passing them to a variable which then controls a Blendspace in a Blueprint animation: alt text (Note that I multiply by Walk Speed to better sync with the animation blendspace thresholds)

In the Animation Blueprint, I then cast to my character blueprint and grab the two variables and use them to set speed and direction in my blendspace: Animation Blueprint.JPG

This works fine for single player, but it seems that not matter what I do, I cant get these two variables to replicate on both the server and client.

I'm relatively new to networking but I tried (unsuccessfully):

1.) Setting both variables to be replicated

2.) Grabbing the axis values via a Custom Event set to Run on Server.

3.) Messing with Has Authority to set both variable, with little luck.

Any help or feedback is much appreciated, thanks!

Product Version: UE 4.15
more ▼

asked May 24 '17 at 12:27 AM in Blueprint Scripting

avatar image

100 6 14 19

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

What is your purpose for replicating these variables to the server? They seem to be only relative for the local client since the server will replicate your actor's location/direction inherently (depending on your setup, but this is the case most of the time). See the "Replicates" property of your actor to determine this.

If you really need them replicated to the server, you should consider replicating them elsewhere than in your controller such as your pawn. Likely the issue you're running into trying to replicate these variables in your controller is that each client has only 1 player controller for their local world. The server is the only entity that knows information about all controllers for each player. This means that if you try to Multicast a function with a controller, it's only going to be called on the owning client and the server, because all other clients do not have the invoking client's controller in their world.

There is of course a work around to this philosophy as you could call an event from a different blueprint (such as your game mode) that emulates the functionality you're expecting by relaying it back to all other player controllers. However, this can quickly become convoluted and I recommend you architecture your flow better than this.

Hope that helps!

more ▼

answered May 24 '17 at 07:21 PM

avatar image

76 1 2 9

avatar image brisck1 May 24 '17 at 07:26 PM

Thanks for the reply. Yep you're completely right on this - I ended up going back and revising the animation blueprint to be controlled by velocity instead of input which worked much better: https://forums.unrealengine.com/showthread.php?145677-Problems-getting-variable-to-replicate-in-animation-blueprint&p=713456&viewfull=1#post713456

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question