void SpawnPoints() { Vector3 position; while (true) { int x = Random.Range(minX, maxX); int y = Random.Range(minY, maxY); position = grid.GetCellCenterWorld(new Vector3Int(x, y, 0)); // if (snake.CheckPoint(position)) { break; } Debug.Log("Refind"); } pointPrefab.transform.position = position; pointPrefab.gameObject.SetActive(true); }