Generating corners for 2d map terrain

Okay so i want to generate corners and half tiles between biomes. But i cant find a solution for finding the right spot to place a certain piece for example how can i identify a tile between two biomes. I added my code that i have been working on for a bit now, if you want to try the code for your self please follow these steps:

  1. Create a tile pallet with 4 diffrent tiles and assign them in the inspector. The tiles are 32x and 32y px, also the scripts should be placed on a empty gameObject.

  2. Move the code in to a start function or call the setSeed

using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.Tilemaps;

public class TerrainGeneration : MonoBehaviour
{
    public Tilemap tilemap;

    public Tile grassFiller;
    public Tile woodsFiller;
    public Tile mountainFiller;
    public Tile waterFiller;

    public int width = 100;
    public int height = 100;

    public float pScale = 10f;
    public int seed;
    private void GenerateTerrain()
    {
        for (int i = 0; i < width; i++)
        {
            for (int x = 0; x < height; x++)
            {
                float xCoord = (float)i / width * pScale + seed;
                float yCoord = (float)x / height * pScale + seed;

                float perlinValue = Mathf.PerlinNoise(xCoord, yCoord);

                Tile tileToPlace = DetermineTile(perlinValue);

                Vector3Int tilePosition = new Vector3Int(i, x, 0);

                tilemap.SetTile(tilePosition, tileToPlace);
            }
        }
    }

    private Tile DetermineTile(float perlinValue)
    {
        float noise = Mathf.PerlinNoise(perlinValue * 20f, seed);

        float waterThreshold = 0.14f + noise * 0.1f;
        float grassThreshold = 0.4f + noise * 0.1f;
        float woodsThreshold = 0.78f + noise * 0.1f;

        if (perlinValue < waterThreshold)
        {
            return waterFiller;
        }
        else if (perlinValue < grassThreshold)
        {
            return grassFiller;
        }
        else if (perlinValue < woodsThreshold)
        {
            return woodsFiller;
        }
        else
        {
            return mountainFiller;
        }
    }

    public void SetSeed(int newSeed)
    {
        seed = newSeed;
        GenerateTerrain();
        Debug.Log("SetSeed called with seed: " + seed);
    }
}

There are about ten billion different ways to do this ranging from shader solutions to custom editor texture-makers that blend-on-demand between things.

Try any one of the ways and see how it goes.

I suggest you get rid of all the above Perlin noise stuff and set yourself up for a win: make a four-corned terrain element with X number of biomes at the corners and ask yourself, “how would I visualize that?”

Like this:

Imphenzia: How Did I Learn To Make Games: