Uh, good question. Can i up vote that?
I worked a couple of days with the ShooterGame example but it seems like i missed that OnRep.
I thought OnReps can’t have any parameters, since you don’t actually call them by hand, so you
can pass something :X
I’m pretty sure you can’t pass Parameters as part of OnRep functions… I’ve never seen that in ShooterGame… where about is it?!
Actually I’ve just realised, you can specify ‘OnRep’ for any replicated variable, BUT you can also call it from elsewhere in the code. It might be that OnRep_CurrentWeapon is actually called manually somewhere as well with the parameters. I’ll have a look in a bit.
I already searched the whole project and i was not able to find any manual call. It is only called through the OnRep logic
when the Server changes the current weapon. I was also sure, that you get an error if you give the OnRep a parameter,
but even this seems to be wrong.
Hey it seems that you were right “If you want the old value, you can add the value as a parameter to the rep notify, and it will pass the old value in that case.”
I don’t think it’s possible since the functions OnRep created automatically has no inputs and you can’t had any, but it’s easy to create another variable that holds the old value.
I know this might be late but if anyone faced this problem in the future, you can pass to the OnRep function a parameter of the same type of the value being replicated under this function, and it will automatically pass the old value of this variable.