Hello,
I have a ScrollView panel with buttons in the Grid inside. It is main screen of my education app, where user choose lesson.
Each button is 2D Sprite with attached scrollview script, and my own control script, which handle OnClick event and OnEnable event:
void OnEnable ()
{
if (Lesson.GetComponent<LessonControl> ().IsReached)
{
GetComponent<UI2DSprite>().sprite2D = Active;
}
else
{
GetComponent<UI2DSprite>().sprite2D = Locked;
}
}
void OnClick ()
{
Debug.Log ("CLICKED!");
if (Lesson.GetComponent<LessonControl> ().IsReached) {
GameObject.Find("MainControl").SendMessage ("StartLesson");
Lesson.SetActive (true); }
}
When some button have been clicked, I deactivate this panel and switch to main camera:
void StartLesson ()
{
NGUITools.SetActive (MainScreen, false);
MainCamera.active = true;
}
After lesson is finished, I activate panel back in the same way:
MainCamera.active = false;
NGUITools.SetActive (MainScreen, true);
But after that the only one button stays clickable, all others stop to catch OnClick (and other mouse events - i tried to attach UIButton script to check it) event. I double check Z coord, widget depth, box colliders - all looks fine, and no visible difference between buttons.
Also, when I test it with two buttons - the first one stay working, when I added two more - the 3rd one...