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!

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:


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:

I’ve never actually tested if modifying an array element by it’s index actually calls OnRep in C++, but I always thought it did. That, or arrays just plain can’t trigger RepNotifies.

I think ‘Adding’ or ‘Removing’ from an array works because it’s size changes. You’ve got me questioning now… I’m gonna find out.

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!