I have to dig up this topic, because I am suffering from the same situation right now.
Unity: 4.5.2f1
NGUI: 3.6.8
1. Create a fresh project
2. NGUI -> Create -> Label
3. NGUI -> Attach -> Collider
4. Attach Script:
using UnityEngine;
using System.Collections;
public class ClickTest : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnClick()
{
Debug.Log("Label Click has been triggered");
}
}
When I play the scene this way, everything works fine. I can click left and right of my label and the event does not get triggered.
5. Change "Overflow => Resize Freely"
This is where the problem begins. I can click anywhere left and right of the label and the click event gets triggered even though I am not even near the text. "Overflow => Resize Height" does something similar with the area above and below the label although that way the area does not go all the way up/down but just a fair bit.
EDIT:This is getting weird. I added more elements to the GUI I am designing and suddenly the colliders work correctly. No idea why, because I haven't touched them again. In my empty scene test the error still exists.