OnCollision return value resolution.

Dec 8, 2012 at 9:43 PM

If I have two handlers registered to one OnCollision event, and they both return different values (one returns true and one returns false), what will happen? Will the collision be disabled or remain enabled?

Thanks,

Kyle

Dec 9, 2012 at 2:01 PM

The value returned will be from the last handler to the multicast delegate that was subscribed. So your question has no answer in its current form  :)

But most importantly you *should not* rely on the order of handlers in the multicast delegate. It's implementation-specific, subject to change, the behavior can be overridden (to use another data structure in the add and remove methods for example like a linked list instead of list), is undefined for asynchronous invocations and concurrency etc. You should rethink your logic in this case to prevent very hard to find bugs in the future that appear out of nowhere.