Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: gamedivisionuk on June 11, 2014, 07:28:11 AM
-
Im getting a problem with UICenterOnClick
Assets/My Files/SearchButton.cs(17,67): error CS0122: `UICenterOnClick.OnClick()' is inaccessible due to its protection level
here is the code,could anyone tell me what i'm doing wrong thanks
using UnityEngine;
using System.Collections;
public class SearchButton : MonoBehaviour {
public Transform gridContainer;
public UILabel searchLabel;
void OnPress ()
{
UILabel[] labels = gridContainer.GetComponentsInChildren<UILabel>();
foreach( UILabel l in labels )
{
print("searching " +l.text + " inside " +searchLabel.text);
if (l.text.Contains(searchLabel.text))
{
print("Found");
l.GetComponent<UICenterOnClick>().OnClick();
return;
}
}
}
}
-
solved by making the void OnClick () public in the UICenterOnClick.cs file