Unity NGUI 批量点击跳转场景

public  GameObject[]   loadLevelBtS;

public  string[]   loadLevelNameS;

 

void addListener(){

foreach(GameObject go in loadLevelBtS){

UIEventListener.Get(go).onPress+=loadList;

}

}

void loadList(GameObject go,bool canwith){

int listener=0;

if(!canwith){

if(listener==0){

listener=1;

int index=int.Parse(go.name.Split('_')[1]);

Application.LoadLevel(loadLevelNameS[index]);

}

}

}

// Use this for initialization

void Start () {

addListener();

}

原文地址:https://www.cnblogs.com/kuangwu/p/2954247.html