I used the script below and this tutorial to follow along: Unity 2D Top Down RPG - Episode 2 - YouTube
using UnityEngine;
using System.Collections;
public class Levels : MonoBehaviour {
private int levelWidth;
private int levelHeight;
public Transform NcolWoodOneTile;
public Transform NcolGrassOneTile;
private Color[] tileColors;
public Color NcolWoodOneColor;
public Color NcolGrassOneColor;
public Texture2D levelTexture;[34992-screenshot+(70).png|34992]
// Use this for initialization
void Start () {
levelWidth = levelTexture.width;
levelHeight = levelTexture.height;
loadLevel ();
}
// Update is called once per frame
void Update () {
}
void loadLevel () {
tileColors = new Color[levelWidth * levelHeight];
tileColors = levelTexture.GetPixels ();
for(int y = 0; y < levelHeight; y++)
{
for(int x = 0; x < levelWidth; x++)
{
if(tileColors[x+y*levelWidth] == NcolWoodOneColor)
{
Instantiate(NcolWoodOneTile, new Vector3(x, y), Quaternion.identity);
}
if(tileColors[x+y*levelWidth] == NcolGrassOneColor)
{
Instantiate(NcolGrassOneTile, new Vector3(x, y), Quaternion.identity);
}
}
}
}
}