public void SpawnFollower() { GameObject enemyspawn = GameObject.Instantiate(Resources.Load("Prefabs/MainCanvas/Enemy")) as GameObject; Destroy(enemyspawn.GetComponent <Enemy>()); Chainer newchainer = enemyspawn.AddComponent <Chainer>() as Chainer; enemyspawn.transform.SetParent(Dial.spawnLayer, false); followers.Add(newchainer); newchainer.FillFollowers(followers); newchainer.delay = delay; newchainer.groupAddedToBonus = groupAddedToBonus; newchainer.spawnedByBoss = spawnedByBoss; newchainer.SetSrcFileName(srcFileName); newchainer.SetTrackID(trackID); newchainer.SetTrackLane(trackLane); //calculate and set position float degrees = (trackID - 1) * 60; //clockwise of y-axis degrees += 15 * trackLane; //negative trackpos is left side, positive is right side, 0 is middle degrees = ((360 - degrees) + 90) % 360; //convert to counterclockwise of x axis degrees *= Mathf.Deg2Rad; enemyspawn.GetComponent <RectTransform>().anchoredPosition = new Vector2(Dial.ENEMY_SPAWN_LENGTH * Mathf.Cos(degrees), Dial.ENEMY_SPAWN_LENGTH * Mathf.Sin(degrees)); newchainer.StartMoving(); }