Converting pixels to unity units

I hope you’ll bear with me through a tediously basic question, but I’m building a function to draw a seamless map composed of individual tiles, the type you would find in a roguelike game. I know the exact dimensions of each tile in pixels (32x32 in this case), so my logic is to start from (0,0,0) and for each new title, offset it down and/or to the right by its size in pixels:

List<Vector3> GenerateMap(int width, int height, int depth, float offsetX, float offsetY){ //OffsetX and OffsetY are the dimensions of each tile in pixels

    List<Vector3> tempMap = new List<Vector3>();

    for (int i = 0; i < width; i++)
        for (int j = 0; j < height; j++)
            tempMap.Add(new Vector3(i * offsetX, j * offsetY, 0));
    return tempMap;

This obviously doesn’t work as intended. I expect the following call to generate a 25x25 grid of tiles, where each tile is 32x32 pixels:


Instead it places a massive amount of space between each tile, which makes me assume I’m missing a conversion that needs to happen. Is there an existing library function I can call on, to somehow convert dimensions in pixels to dimensions in unity’s own units?

In most cases you would set the pixel-to-unit value so that it works out to 1 unit per tile; it just generally makes things easier. So a 32x32 tile should have a pixel-to-unit value of 32. Then set the tiles 1 unit apart, and set the viewport of the camera so the tiles are the size you want. You don’t really need to worry about exact pixel values, most of the time. Unless you really really want each pixel in the tile to exactly equal 1 pixel on-screen, but it’s actually not that big a deal if it’s not. Scaling usually works fine, plus you don’t want people running high dpi (4K and up) monitors to have tiny itty bitty tiles.