Author Topic: Can't click in NGui Button created by prefab  (Read 1937 times)

windvn

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Can't click in NGui Button created by prefab
« on: September 25, 2014, 02:28:51 AM »
My Problem is:
 I create ngui button by prefab .Then I add button to my horizontal scroll view

 foreach (var map in player.Mapdata)
        {
            //var mapx=Instantiate(mapprefab, new Vector3(-100, 0, 0), Quaternion.Euler(0, 0, 0)) as GameObject;
            var mapx = NGUITools.AddChild(ScrollViewWrapMap.gameObject, mapprefab);
            if (mapx != null)
            {
                var mapc = mapx.GetComponent<MapItem>();
                mapc.SetData(map);
                mapx.transform.localPosition = new Vector3(pointStart + (index++) * 200.0f, 0, 0);
                mapx.transform.localScale = Vector3.one;
                mapx.transform.localRotation = Quaternion.identity;
                NGUITools.SetActive(mapx, true);
               
            }
        }

My map button is display in scrollview an my horizontal scorll view is work But I can't click in my button.

When I click forward button in Unity Editor to change depth then i can click button.

But when I change depth by my code then my button still can't click.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Can't click in NGui Button created by prefab
« Reply #1 on: September 25, 2014, 07:33:48 PM »
Have a look at NGUITools.BringForward.