Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: windvn on September 25, 2014, 02:28:51 AM

Title: Can't click in NGui Button created by prefab
Post by: windvn 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.
Title: Re: Can't click in NGui Button created by prefab
Post by: ArenMook on September 25, 2014, 07:33:48 PM
Have a look at NGUITools.BringForward.