RepNotify for offline single-player games?

Hello,

Is it okay to set the variable to RepNotify (in 100% single-player game) and then use its OnRep_[Variable name] Function for cases where i would want to handle some logic every time the value of that variable changes?

Hey there, but why dont you use a setter function instead? Every time you want to change the value of variable X you do a SetX() that sets the value and does additional logic.

The only difference is that everytime you change the variable instead of doing X = 2; you do SetX(2); (from the same class or from others, as long as you set the function to public) and it runs whatever update code you want in the set, so it’s kind of the same thing but more lightweight than repnotifies, but it’s up to you, if it works and it’s more convenient for you then use it, the overhead shouldnt be very noticeable.

I dont know, it seems more convenient for me, for example if i have some variable that gets changed a lot from a few different places and every time it does i want to do the same thing, its easier for me to just change the variable and let the repnotify function handle the rest.

Thanks, i believe you answered my question.

Good to know :slight_smile: Please mark the answer as correct to close it :slight_smile:

In addition, RepNotify variables add 4 bytes of RAM per object, for networking logics.

Keep that in mind.

Thanks for the info, i’ll keep that in mind.