//生成所有小车 public void CreateCars() { //创建车组 GameObject carGroup = new GameObject(); carGroup.name = "CarGroup"; for (int i = 0; i < GlobalVaribles.car_list.Count; i++) { GameObject carObj = CreateModel.CreateCar(GlobalVaribles.car_list[i]); //更新allCars和allocableCars数组 GlobalVaribles.allCars.Add(GlobalVaribles.car_list[i]); GlobalVaribles.allocableCars.Add(GlobalVaribles.car_list[i]); carObj.transform.parent = carGroup.transform; } }