Very new to UMG and so many of the guides I’m reading are conflicting … or don’t deal closely enough with my scenario to allow me to take anything away from it.
I have a “sun” (directional light) actor. The server executes a timeline to change its intensity over time to simulate a day/night cycle.
The “Daylight Intensity” variable is set to rep notify so the client can update the sun’s intensity whenever it changes on the server.
Note: I realize this is probably not ideal. This is spamming network messages to all clients on the tick of a timeline update. Really, I wanted to have everyone running their own timeline and every 1 second or so, the server would update a variable with rep notify to tell all clients what the current time was to sync them. I got frustrated making it so I just did this for now. I’ll fix it later when I have more patience.
Updating the light’s intensity
That all works well and good. I have a simple widget with a text box that I want to display the current time of day which is the current position of the timeline. I’m not sure how to go about doing this. I don’t know where that logic should be executed.
In the widget, I set the text box to be a variable by ticking the box in the top right.
I then went back to my sun blueprint and added a bit to the end… getting the player character of player index 0, casting it to my character, getting the widget, getting the text box variable and updating it with the current “Daytime Position” - the replicated variable saved by the server (Note: I realize in the first screenshot the Daytime Position did not show up as replicated, I was just playing with stuff)
So firstly, is that how this should be handled? It was kinda guesswork and it does seem messy.
Secondly, there’s a strange gap in updating the GUI. The timeline runs for 24 seconds. On the server, I see the text updates perfectly fine with every tick showing the float from 0-24.
On the client… the text stops updating between 21 and 3. When I first start it up, there is no display on the client until the timeline hits 3. Then once it hits 21… it stays as “21” until it hits 3 again.
Server keeps going but client stopped at 21…
Server keeps going but client stopped at 21… (note, it’s slightly different from the previous “21” because I took the screenshots on different loops, but it’s always between 21-3
After 3, it starts updating again.
I have no idea what is causing this but it’s making me think my method of updating the GUI is wrong.
Also, I just noticed I get some errors when I end the execution.
So for some reason, between 21 and 3 in the actor "GlowSunBP"s event graph, it can’t find the player’s widget. I … have no explanation for this.
Thanks for reading!