public static UnitCreateOnBuildPanel InstantiateUnitBtn(GameObject gObj, UnitInSquadController unitPrefab, City city, DBTypes.Unit unit)
    {
        UnitCreateOnBuildPanel result = gObj.AddComponent <UnitCreateOnBuildPanel>();

        result.UPrefab    = unitPrefab;
        result.UCity      = city;
        result.UnitParams = unit;

        return(result);
    }
    /// <summary>
    /// Скрипт удалит старый список отображаемых построек и построит новый на основе входных данных
    /// </summary>
    /// <param name="AvaiableBuildings">Список доступных построек</param>
    /// <param name="NotAvaiableBuildings">Список недоступных построек, которые нужно отобразить</param>
    /// <returns></returns>
    void UpdateList(City city)
    {
        //Debug.Log("Вызван UpdateList(city), " + city.ToString());
        lastCity = city;
        InstantiateBuildingsInProgress(city);
        //метод должен сработать только для активного окна (только для нужного города)
        //если gameObject текущего списка не активен, ничего не делать
        //if (!this.gameObject.activeInHierarchy)
        //        return;

        //_______________ лезем в БД за списком
        DataService ds = DataService.WARSQL;

        buildings = ds.GetBuildingsWithImage();
        units     = ds.GetUnits();
        //________________

        //удаляем все, что отображалось до этого
        if (_DisplayedGameObjectList != null)
        {
            foreach (GameObject gObj in _DisplayedGameObjectList)
            {
                Destroy(gObj);
            }
            _DisplayedGameObjectList.Clear();
        }   //зачистим список
        else
        {
            _DisplayedGameObjectList = new List <GameObject>();
        }


        //if (AvaiableBuildings == null)
        //    {
        //        Debug.Log("На вход UpdateList подан пустой список");
        //        return;
        //    }//

        GameObject tmpGObj;//= new GameObject();

        if (buildings != null)
        {
            foreach (SBuilding building in buildings)
            {
                //Debug.Log(building.ToString());
                //TODO вынести в фабричный метод
                building.SetStatus(Status.New);
                building.SetOwner(city);

                tmpGObj = Instantiate(defaultButton, _content);
                tmpGObj.GetComponent <Image>().sprite = Resources.Load <Sprite>(building.pathToImage);
                tmpGObj.AddComponent <Creation_BtnBuilding>().building = building;

                _DisplayedGameObjectList.Add(tmpGObj);
                //ToConsole(person.ToString());
            }
        }

        if (units != null)
        {
            foreach (DBTypes.Unit unit in units)
            {
                tmpGObj = Instantiate(defaultButton, _unitContent);
                tmpGObj.GetComponent <Image>().sprite = Resources.Load <Sprite>(unit.PathToImage);
                //tmpGObj.AddComponent<Creation_BtnUnit>().unit = unit;
                UnitCreateOnBuildPanel btnScript = UnitCreateOnBuildPanel.InstantiateUnitBtn(tmpGObj, city.cityBeh.Unit, city, unit);

                Debug.Log(unit.MoneyUpkeep);

                _DisplayedGameObjectList.Add(tmpGObj);
            }
        }
    }