NGUI events are consumed by the first collider, so I am guessing you're doing your own raycasts, which is where the problem comes from.
No, I'm not using any raycasts.
The basic setup:
Object1 scripts:
void OnPress(bool isDown)
{
UICamera.genericEventHandler = gameObject;
//Debug.Log(UICamera.currentTouch.current.collider.name);
if(isDown)
{
if(UICamera.currentTouchID == -1)
{
SelectionManager.GetComponent<SelectedManager>().SelectedObject = gameObject;
Debug.Log("Object1 Selected");
}
}
}
Object2 Script: (basically the same exact thing)
void OnPress (bool isDown)
{
if(isDown)
{
SelectionManager.GetComponent<SelectedManager>().SelectedObject = null;
MoverShower.SetActive(false);
Debug.Log("Object2 Selected");
}
}
If all you do is click the first object, nothing bad happens. It prints out correctly that Object1 was selected over and over again with each click. If you click off that object and onto Object2 you get the Object2 Selected print out. BUT if you then go back and click back on Object1, it prints out both "Object1 Selected" "Object2 Selected".
1 Odd thing: if you set the console to collapse, it groups all similar print outs. There's a "Object1 Selected" print out and TWO "Object2 Selected". 1 populates when Object1 is clicked (which it shouldn't), the other populates when Object2 is clicked.
The information at the bottom of the console is almost exactly the same with one difference between the two One is:
"UICamera:Notify(GameObject, String, Object) (at Assets/NGUI/Scripts/UI/UICamera.cs:
734" the other:
"UICamera:Notify(GameObject, String, Object) (at Assets/NGUI/Scripts/UI/UICamera.cs:
730"
Looking at UICamera I'm guessing its telling me I'm not using a generic event handler for the second click?
Any ideas on what this could be?