public class ParentScript : Monobehaviour
}
public List<GUIElement> Elements; //fill this in in Unity - I rebased all of the NGUI elements to GUIElements, so as to standardize it with my own custom elements that are with the GUI but not based upon anything NGUI-related, but you could just as easily use UIWidget, which would cover most of it.
public void Open(Buttons[] parameters)
{
//move the transform
MoveAndShowThisObject(UICamera.lastHit.point); //The UICamera will store the RaycastHit info
//Alternatively, use your own Ray from Camera.ScreenToWorld (sp?) and get the hit info from that.
for (int i = 0; i < parameters.Count; i++)
{
if (Elements.Count > i) ShowButton(Elements[i]); //configure the button here, I use delegates and change the sprites and other things like that, since I have a 50-60 different contextual options for a spell menu in my RPG.
}
for (int i = parameters.Count; i < Elements.Count; i++)
{
if (Elements.Count > i) HideButton(Elements[i]);
}
}
}