I can add a function via code to a series of instantiated prefabs with this:-
UIButton third = assignmentEntry.transform.GetChild(2).GetComponent<UIButton>(); // gets the button component
EventDelegate.Set( third.onClick, onClickAssignmentListEntry ); // adds the onClickAssignmentListEntry function fine
However, I want the function to receive an argument so I can identify which button out of the prefabs was pressed ( each will be given an individual number).
I am aware that I need to use the EventDelegate.Parameter to add these arguments before setting the event delegate, however I can’t work out how this should be structured.
Ideally the function would be:-
public void onClickAssignmentListEntry ( int entry number ) {
// each button will have it’s own entry number
}
How do I create an event delegate to enable the function onClickAssignmentListEntry to be passed an integer ( or a string that I can cast to an integer)?
Many thanks in advance.