I am using the UIToolkit from Prime31 and trying to create a Scrollable Container and where a user can click an item within that scroll list and only update its text on the button. I have played around with the Demo Asset that came with the script
called (https://github.com/prime31/UIToolkit/blob/master/Assets/DemoSceneScripts/ScrollableContainerManager.cs) the problem I run into is that the when I click say button 2 out of 10 and try to update the associated text for button 2 it keeps updating the last element in the scrollable list. My question is how do I associate the button.onTouchUpInside index back to the text instance so it knows to update the correct button text? Do I need to turn the text instance to an array then feed the button instance back to the text instance through the array so it knows what array element to update?
I have tried setting the text.parentObject back to the button but still no luck.
This is the section of code where that association should be handled,
// only add a touchUpInside handler for buttons
if( touchable is UIButton )
{
var button = touchable as UIButton;
// store i locally so we can put it in the closure scope of the touch handler
var j = i;
button.onTouchUpInside += ( sender ) => Debug.Log( "touched button: " + j );
}
Any thoughts?