RepNotify should provide previous value as argument in OnRep_XXX functions

Whenever you have a variable that you want to notify everybody that the value changed, making it RepNotify is super useful, however the problem is that *a lot *of the times you want the previous value it had too.

My proposal is that OnRep_XXX functions should receive as an argument the previous value that variable had, that way I can do some things on it.

There are quite some use cases where this is useful. For example, for me atm the use I was having was picking an object. When the object gets picked, it gets attached to the character, and when it is dropped it gets detached. However, if I am already carrying an object, I want to detach the one I’m carrying before attaching the new one.

Another really common use case is when you have states, and you want to do certain things based not only on the new state you changed to, but also do things because you left a specific state (e.g. slide some ui element off screen).

ATM you basically have 2 options (that adds ugliness and unnecessary complexity):

  1. drop RepNotify, and simply have multiple RPCs
  2. keep RepNotify, and have local variables that you cache the previous value before leaving OnRep_XXX functions

Since the previous value is there already when OnRep_XXX is called, I think just having it available as a in parameter would be very useful.

Nuno Afonso

Hi nafonso,

Thank you for your request. We will take this into consideration.

Agreed. This would be a super useful addition! Or even the possibility of an alternative such as OnPreRep_xxx although an optional argument of the previous value would probably be a bit more fluid. Awesome idea!

This would be quite nice