so i wrote this code to make 25 square with distance but when i start the game list says there is 25 squares but in screen there is only 21 square that instantiated (btw when i try to increase the "if(rightNumber)" part square number is increasing)
public class GameManager : MonoBehaviour
{
public List<int> Tile = new List<int>();
public List<int> MineTiles = new List<int>();
public GameObject InstantiatePosition;
public GameObject TileGameObject;
public GameObject Canvas;
private int TileNumber = 25;
private int MineNumber = 3;
public int rightNumber = 0;
public void Start()
{
for (int tileNumber1 = 0; tileNumber1 < TileNumber; tileNumber1++)
{
if (rightNumber < 5)
{
GameObject instantiatingTile = Instantiate(TileGameObject, InstantiatePosition.transform);
instantiatingTile.transform.parent = Canvas.transform;
InstantiatePosition.transform.position += new Vector3(100, 0);
rightNumber++;
}
else if (rightNumber >= 5)
{
rightNumber = 0;
InstantiatePosition.transform.position = new Vector3(InstantiatePosition.transform.position.x - 500,
InstantiatePosition.transform.position.y - 100);
}
Tile.Add(tileNumber1);
}
}