public void InitCreepParameter(List <UnitCreep> list) { //~ Debug.Log("init creep "+creepParameter.Length); UnitParameter[] temp = new UnitParameter[list.Count]; for (int i = 0; i < list.Count; i++) { bool match = false; //~ Debug.Log(list[i].gameObject); //~ for(int j=0; j<creepParameter.Length; i++){ foreach (UnitParameter UP in creepParameter) { //~ UnitParameter UP=creepParameter[j]; if (UP.unit = list[i].gameObject) { temp[i] = UP.Clone(); match = true; break; } } if (!match) { temp[i] = new UnitParameter(); temp[i].unit = list[i].gameObject; } } creepParameter = temp; //~ creepParameter=new UnitParameter[temp.Length]; //~ for(int i=0; i<temp.Length; i++){ //~ creepParameter[i]=temp[i]; //~ } //~ for(int i=0; i<temp.Length; i++){ //~ Debug.Log(i+" obj:"+temp[i].unit+" "+list[i].gameObject); //~ } }