1
NGUI 3 Support / event tunneling
« on: August 14, 2014, 12:28:39 AM »
Sometimes we are in the situation that we have overlapping colliders where all (or a couple of them) should get events from UICamera ... here comes event tunneling in place. because you are doing a raycastall in your raycast function anyway we would store the sorted list of hitted objects (with respect of being active and transparancy of cause) in a queue and in the "notify" function of UICamera we would have a struct like:
struct ParamStruct {
Queue<GameObject> hittedObjects;
object param;
}
and always send this struct in the SendMessage function. Therefore each function in the user defined scripts would get the list of hitted objects and can define by themself if they want to consume the event (by simple ignoring the queue of hitted objects) or send it further to the next nearest hitted gameobject by calling a SendMessage to the next object in the queue (and remove the first entry in the queue of cause).
Do you think it's a good idea and could be part of NGUI?
Thanks in advance,
Silvio
struct ParamStruct {
Queue<GameObject> hittedObjects;
object param;
}
and always send this struct in the SendMessage function. Therefore each function in the user defined scripts would get the list of hitted objects and can define by themself if they want to consume the event (by simple ignoring the queue of hitted objects) or send it further to the next nearest hitted gameobject by calling a SendMessage to the next object in the queue (and remove the first entry in the queue of cause).
Do you think it's a good idea and could be part of NGUI?
Thanks in advance,
Silvio
