"RepNotify" variable not initially updating on client...

G’day all,

I’m having some difficulty troubleshooting an issue with a Blueprint (refer to the screenshots below) that I’m modifying in an attempt to get it syncing correctly in a networked game. Essentially, three dynamic material instances get created when play begins, then — on the server — three “RepNotify” variables are assigned values and a parameter on the dynamic material instances gets modified (via “Rep On” functions). This happens twice more (with delays included for timing), and then the whole process repeats. On the server, this works perfectly. However, on the client the modified “RepNotify” variables (and by association the dynamic material instances) aren’t reflected on the initial “Red Light Active” function, but work perfectly fine thereafter. Due to the temperamental nature of the issue, it has me baffled. Any help will be greatly appreciated!

Variables are not replicated if their value did not change. So if you set the value of the yellow light intensity to zero and it was zero before, the notify function will not be called.
My guess is that this is the problem. You could initialize the parameters to zero when creating the materials.

1 Like

Thank you for replying. That was one of the theories, as the default values for the variables are indeed 0 (and two of them remain 0 after the first function), but even after changing the default values and the initially set values so that they’re different, the issue persists.

No idea then :frowning:
Random guess: Replace the delay nodes with timers. Delay nodes are know to cause strange behavior

Can you show us the replication setup? Is “Always relevant” checked?

Thank you for replying (again). Nothing out of the ordinary. “Replicates” and “Net Load On Client” are both checked and that’s it. I’ve tried “Always Relevant”, but the issue persisted. I think I know what is occurring, just not why. Essentially, the clients aren’t receiving the initially set values on the “RepNotify” variables. So, there is a discrepancy between the server/client.


Post "Red Light Active":
	Server:
		"RedLightIntensity":	10
		"YellowLightIntensity":	0
		"GreenLightIntensity":	0
	Client (* Material Default):
		"RedLightIntensity":	10
		"YellowLightIntensity":	10*
		"GreenLightIntensity":	10*

Post "Green Light Active":
	Server:
		"RedLightIntensity":	0
		"YellowLightIntensity":	0
		"GreenLightIntensity":	10
	Client (* Material Default):
		"RedLightIntensity":	0
		"YellowLightIntensity":	10*
		"GreenLightIntensity":	10

Post "Yellow Light Active":
	Server:
		"RedLightIntensity":	0
		"YellowLightIntensity":	10
		"GreenLightIntensity":	0
	Client (* Material Default):
		"RedLightIntensity":	0
		"YellowLightIntensity":	10
		"GreenLightIntensity":	0

This is why it corrects itself after a loop. So, I need to work out why the client isn’t receiving the initially set values on the “RepNotify” variables.

Hi,

i would also replace the delay nodes with timers.
Without knowing the code representation of the blueprint nodes, i would just think that you never really get out of the BeginPlay - Event with your code (you execute something, delay, execute something, delay…repeat).
With timers you have it asynchronously and they can loop too, so this should be easy to achieve, and delay most of the time makes headaches.

Though as said, it could also be perfectly ok the way you did it, so just try :slight_smile:

Cheers,

No luck changing the delays over to timers. :confused:

A big thanks to “” for resolving this issue! The solution was as follows:

Thanks for your reply. Eight years later and who knew your answer would be helpful to me. lol

Exactly that same value will not call “RepNotify”. I solved it by just putting another initial value instead of zero and it worked. My problem looked like a bug, but in fact whenever it falls into the alternative value 0, it doesn’t call. Now all makes sense.

So many years using UE and I had no idea about it. Living and learning.

Sincerely, HighRender.