Set Array Elem Repnotify

Hey everyone,

I’ve got a feature request. So I’ve been working with repnotified arrays for a while on a project. Now the issue with this is whenever it set’s array elem it doesn’t repnotify.
Is it possible to have an option on set array elem to repnotify? This would be awesome as i wouldn’t have to “set array” after all the actions. If this isn’t possible in the way that replication works then just ignore this. Just an idea!

thanks in advance!

2 Likes

I think the reason this doesn’t work is because in order for the Property Tracker to see what values have changed, it needs to check them and compare to previous value each time it’s considered for replication. For an array, that would mean looping over all of it’s elements and storing a copy of it somewhere to see if it had changed that tick. On large arrays that could become pretty expensive.

What you could do instead, is when you set an element in the array, replicate a second ‘bool’ variable called bArrayIsDirty - and setup your ‘RepNotify’ function to respond to that variable instead. When it does, do stuff with the array and set bArrayIsDirty back to false (server and client side).

Give the second option a try but if that still doesn’t work then I’m just talking garbage :wink:

Hey,

Yea that sounds logical, was just a question :slight_smile: And the solution might work… It’s not amazing, but it’s something. It will work by the way i hear it so it’ll be good and probably shortcut my code a bit :slight_smile:

Well, set array doesn’t. But remove and add might indeed… Let me know if it does! :slight_smile:

Just ran into this, was expecting it to trigger RepNotify as well. Boooo.

Hope it gets rep notified soon!

I had this issue a while ago, I just create my own setter functions where I add/remove an element and once I’ve done that I just set the whole array equal to itself, which triggers the repNotify then.

Then make sure to only use the setter methods.

2 Likes

UE 5.3

This is the workaround: “just set the whole array equal to itself … =D”

image

Worked!