// Start is called before the first frame update void Start() { _pooledAmount = _cloudPrefabs.Count * _amountOfTypeClouds; _cloudsAmount = _amountOfTypeClouds; for (int i = 0; i < _pooledAmount; i++) { if (i == _cloudsAmount) { _index++; _cloudsAmount += _amountOfTypeClouds; } CloudBehaviour obj = Instantiate(_cloudPrefabs[_index], this.transform); obj.Buffer = buffer; obj.gameObject.SetActive(false); _clouds.Add(obj); } InvokeRepeating("SpawnCloud", _cloudTime, _cloudRepeatTime); }