Download

RepNotify for arrays not triggered when modifying a contained value by reference

If you create an array of structs and set it to RepNotify, then you get an array element by reference and modify it using “Set members in struct”, the array element is correctly modified. However, it does not trigger the associated RepNotify function.

This makes sense because I doubt it’s efficient for UE4 to compare the values of a variable to see if they’ve changed. And since I’m modifying a value contained within the array by reference, I’m bypassing whatever trigger is used to see if the array itself has changed.

Is there any way for me to manually tell the array “You have updated” without touching the contents? I have many values in this array and I do not wish to actually change anything other than the one element I am updating (which was my main purpose for getting the element by reference). I can’t manually call my “OnRep” function, so can I manually modify some element of that array to say “You were updated, do what you gotta do”?

If not, I suppose I just need to write my own OnRep function and call it manually any time I update the array values. But I’d rather not have to do that.