Not entierally sure if this is in the right place, but yeah.
So right now I have a basic script to find the border of a color, then using SetPixel(), I set the pixel of another texture 2d and apply it to a matieral. It works for strait lines, but when I made this image:

Yet it creates this:
I have no idea why. The code seems fine:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MapDisplay : MonoBehaviour
{
[SerializeField]
Texture2D provinceMapTexture;
Color provinceBorderColor = new Color(0, 0, 0);
public GameObject MapDisplayObject;
private void Awake()
{
int provinceTextureMapWidth = provinceMapTexture.width;
int provinceTextureMapHeight = provinceMapTexture.height;
Texture2D provinceMapTextureDisplay = new Texture2D(provinceTextureMapWidth, provinceTextureMapHeight);
for (int x = 0; x < provinceTextureMapWidth; x++)
{
for (int y = 0; y < provinceTextureMapHeight; y++)
{
Color previousPixel = provinceMapTexture.GetPixel(x - 1, y - 1);
Color currentPixel = provinceMapTexture.GetPixel(x, y);
if (previousPixel != currentPixel)
{
provinceMapTextureDisplay.SetPixel(x - 1, y - 1, provinceBorderColor);
}
}
}
provinceMapTextureDisplay.Apply();
MapDisplayObject.GetComponent<Renderer>().material.mainTexture = provinceMapTextureDisplay;
}
}
Also it would be helpful to remove the Anti-Aliasing (I think thats what it is)



