Unity won't render my tiles.

So I am flowing along to this tutorial for making a grid based 2D game link text.I have copied all the code to the letter:

[SerializeField] private int _width, _height;
[SerializeField] private Tile _tilePrefab;
[SerializeField] private Transform _cam;

void Start()
{
    GenrateGrid();
}

void GenrateGrid()
{

    for (int x = 0; x < _width; x++)
    {
        for (int y = 0; y < _height; y++)
        {
            var spawnedTile = Instantiate(_tilePrefab, new Vector3(x, y), Quaternion.identity);
            spawnedTile.name = $"Tile { x}, { y}";
            var isOffset = (x % 2 == 0 && y % 2 != 0) || (x % 2 != 0 && y % 2 == 0);
            spawnedTile.Intit(isOffset);
        }
    }
    _cam.transform.position = new Vector3((float)_width / 2 - 0.5f, (float)_height / 2 - 0.5f, -10);
}

}

and

[SerializeField] private Color _baseColor, _offsetColor;
[SerializeField] private SpriteRenderer _renderer;

public void Intit(bool isOffset)
{
    _renderer.color = isOffset ? _offsetColor : _baseColor ;
}

}

but at the moment when it’s spoused to render the tiles in different colours they become invisible.They are still spawned mind you , and the render says they are coloured as they should be, but are simply not visible. Everything before the colour rendering works fine, and then bam they disappear.I am thinking it’s the camera or something. Help.

You are instantiating the object put never giving it a parent which means it wont appear in the hierarchy and therefore not appear in the game view. Add this line in the loop in the first script. “spawnedTile.transform.SetParent(transform);”. This parents every tile to the gameobject the first script is attached to.