public void addpiece(GameObject pellet) { collisionactive = true; GameObject.Destroy(pellet); Vector3 newpieceposition = lastpiece.transform.position; newpieceposition.x += xvector * spaceinterval; newpieceposition.y += yvector * spaceinterval; var newpiece = Instantiate(snakepiece, newpieceposition, lastpiece.transform.rotation); if (firstpiecepunt == 0) { newpiece.tag = "firstpiece"; } newpiece.name = "snake " + firstpiecepunt + ""; // newpiece.transform.position = lastpiece.transform.position; // newpiece.transform.Translate((new Vector3(xvector * .28f, yvector * .28f))); lastpiece = newpiece; snakepieces.Add(newpiece); controlscript.spawnpellet(); score += 10; Score.text = "Score: " + score; firstpiecepunt++; snakespeed += -(.01f - (firstpiecepunt / 40)); collisionactive = false; // movesnake(); }