GameObject
grid下挂入脚本 MultiRowWrapContent
代码:
UIWrapContent _wrapScript = grid_mt_SearchItem_Ingredients.GetComponent<UIWrapContent>();
_wrapScript.onInitializeItem = OnUpdateIngredients;
_wrapScript.onInitializeItem = OnUpdateIngredients;
Range Limit,这个范围是在:-最大数量+1 ~ 0。至于前面的负号,你可以去看看它的实现原理。比如你共显示20条数据,那么范围就是-20+1~0(-19~0)。
_wrapScript.minIndex =-1*Mathf.CeilToInt(data_Ingredients.Count*1.0f/((MultiRowWrapContent) _wrapScript).rownum)+1;
cull content 选项取消勾,才能实现 go.gameObject.SetActive(false);
void OnUpdateIngredients(GameObject go, int index, int realIndex){
datas = data_Ingredients;
if (realIndex < datas.Count)
{
go.gameObject.SetActive(true);
}
else
{
go.gameObject.SetActive(false);
}
}