Watched a video tutorial about Event Delegates but still can't get on with it.
I have a Popup List. In previous old NGUI versions I simply had to set some object on Event Receiver and Function Name.
But now, as I understand, I need to set the same object in Notify in OnValueChange section of Popup List, and set Method (which is function, right?). I made the needed function public but there appeared Arg 0 and I don't know what to set there.
Here's the code:
public static string MyselectedItem;
public void OnSelectionChange (string selectedItem) {
UILabel lbl = GameObject.Find("MainBuildPriceText").GetComponent<UILabel>();
UISprite sprite = GameObject.Find("MainBuildPicture").GetComponent<UISprite>();
if (selectedItem == "[FF6633]Kiosk")
{
MyselectedItem = selectedItem;
//print ("selectedItem = " + selectedItem);
sprite.spriteName = "KIOSK";
lbl.text = BuildMain.build1_price.ToString();
}
if (selectedItem == "Store")
{
MyselectedItem = selectedItem;
//print ("selectedItem = " + selectedItem);
sprite.spriteName = "kramnytsia";
lbl.text = BuildMain.build2_price.ToString();
}
With nothing set on Arg 0 it says:
failed to convert parameters
Expected: System.String selectedItemEdit: Put code in [ code ] tag. -Nicki.