DateTime object not replicating from server GameState to client GameState
My GameState is configured so the instance on the server continually updates a game clock DateTime object. Although the clock ticking is working perfectly on the server it is not replicating the updated DateTime object to the client. I don't know if this is because I am reassigning the variable to a new object instance which may be breaking replication?
Here's my GameState.
Here's my UMG widget that is using the Game State replicated date time object. The result of calling GetHourMinutes is "0" which is the default value in the above Make Timespan. I launched PIE using the dedicated server option so the screenshot below is of a client connection.
When I run PIE without dedicated server so I play the game as client and server the result of the print string is below.
Here's my GameState game clock variable.
This is the GetClockMinutes function in the GameState.
After some more testing, it turns out that DateTime does not replicate properly.. It seems to be a known bug.
For the meantime, here's what I did as a workaround. Works great
Of course you wouldn't want to call this every tick. I would suggest having the server/client sync up, and have the client independently change the clock, with checks from the server every so often. (And really you'd want to do it this way to save bandwidth usage even if datetime was replicating)
Hey there Elite,
I think your on the right track, because of the using "make timespan" and your not carrying all the values across from the "old" variable.
But instead of doing it that way, why not use the node "Set Member of XXXX". Then you can wire in the variable you are using, and set the seconds value, with everything else being maintained as is, instead of creating a new TimeSpan object.
Here's a link to my blog, where I describe it.
Hope this helps,
answered Jun 05 '16 at 07:39 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here