0

we are using NGUI, some collider has to be overlapped, and we want the ONDragOver() event received by the collider behind, ie should pass through to the underneath collider, Here is a demonstration of the situation:

enter image description here

The bigger one is on top of the smaller ones, and they are in the same hierarchy so that I can drag to move all of them.

I have tested that when object dragged over

 void OnDragOver(GameObject that)
    {
        Debug.Log("you are on drag over workpanel not the brick slot");
        //Debug.Log(" I am being draged over by : " + that.name);
    }

This log will show to indict that the bigger collider will receive the event.

But actually, I want the smaller one in it to receive the event :-(

armnotstrong
  • 8,605
  • 16
  • 65
  • 130

1 Answers1

0

I have figured this out, change the z position of the collider want to hide behind to a larger value, so the one with a smaller z will get the event first, this may help with people with similar issue.

This may cause the bigger collider not to get the event when hit on the smaller collider, but, whatever, I think this will be good enough for this situation, if someone has a better solution, let us know ;D

And you also should know that the panel meters too. If you have a button collider that became not clickable after colliders overlapped, try to arrange the button in a new panel and tweak the panel depth.

armnotstrong
  • 8,605
  • 16
  • 65
  • 130