Reply To: how do i correlate a KVO with a particular object?

Home Forums Syphon Syphon Development – Developer how do i correlate a KVO with a particular object? Reply To: how do i correlate a KVO with a particular object?

#5162
bangnoise
Keymaster

my question i suppose had more to do with what the ‘object’ and ‘change’ were referring to.

NSKeyValueObserving Protocol Reference

I’m ok with just receiving notifications after the event.

Receiving them prior to the event would be necessary if you wanted to discover details of a retiring server via KVO, which is why I mentioned it (after the event it has gone). However it sounds like the NSNotifications route might be more useful.

why does the indexes key in the ‘change’ NSDictionary* refer to an NSIndexSet and not an NSNumber? Is it because there could be multiple changes happening in the same frame?

yep, exactly.

The way I’ve been dealing with that previously is just polling a bool that represents ‘did something change?’ that is triggered by the KVO. This is not very explicit, which is a shame, as I’d like to perform different tasks in Unity based on whether it was an Announce/Retire/Update, while at the same time performing the least amount of C# -> C++ interop; this is more a design issue than a code one i suppose.

Use three bools? 😉

Yep I don’t know enough (anything) about Unity to make any suggestions really – if you’re not allowed to/can’t post state changes outside calls into your plugin then you’ll just have to accumulate them like you are. Sorry, not very helpful!