Hi. I'm finishing some plugin but I need help with an issue. I have an indeterminate number of people on a scene (any scene) and I need to setup an UIDynamicPopup for each one. So from the code below, is there any way to get 'i' inside the callback functions? I can resolve this by creating a separate callback function for each posible person, but it must be a way to get from which popup the call is coming from.
Code:
for(int i = 0; i < NUMBER_OF_PLEOPLE; i++)
{
JSONStorableStringChooser[] person[i] = new JSONStorableStringChooser("person" + i.ToString(), null, "", "", SyncAtom);
RegisterStringChooser(person[i]);
UIDynamicPopup dp = CreateFilterablePopup(person[i]);
dp.popupPanelHeight = 1000f;
dp.label = "Person #" + i.ToString();
dp.popup.onOpenPopupHandlers += SyncAtomChocies;
}
Code:
// before opening the popup
private void SyncAtomChoices()
{
// populate with person[i] string posibilities (HOW DO I GET i INSIDE HERE)
}
Code:
// after choosing a string from the popup
private void SyncAtom(string atomUID)
{
// set person[i] = atomUID (HOW DO I GET i INSIDE HERE)
}