void SpawnUnicorn() { GameObject newpony = PoolManager.getGameObjectFromPool(UnicornPrefab); Unicorn newPony = newpony.GetComponent <Unicorn>(); newPony.gameManager = gameManager; newPony.transform.parent = null; newPony.transform.position = new Vector3(transform.position.x + Random.Range(-3, 3), -1.04f, -unicorns.Count); newPony.myHome = this; newPony.foodIHave = 0; newPony.hasFood = false; newPony.uniItem.gameObject.SetActive(true); newPony.uniItem.GetComponent <SpriteRenderer>().sprite = newPony.Weapon; newPony.tempVictim = null; newPony.deadTimer = 2f; newPony.timerGettingFood = 1.5f; newPony.RightWall = rightWall; newPony.warehouse = warehouseBuild; newPony.rightCamp = rightCamp; newPony.mainCamp = mainCamp; newPony.pegaSpawn = PegaSpawn; newPony.Player = Player; newPony.ursa = Ursa; newPony.health = 60; newPony.GetComponent <RandomSex>().newPony = true; newPony.GetComponent <UnicornMovingController>().ForgetColors(); newPony.GetComponent <RandomColor>().newPony = true; RandomColor[] otherColors = newPony.GetComponentsInChildren <RandomColor>(); for (int i = 0; i < otherColors.Length; i++) { otherColors[i].newPony = true; } unicorns.Add(newPony); magicTimer = 0.3f; CheckAudio(); _audi.PlayOneShot(SpawnClip); }