How to apply UV to Mesh in 2D tilemap?

I am trying out example project from:

I can render the pink square, but when I apply the UV, I don’t see anything. The code is exactly as he has it, so I suspect the way I’m importing the image is incorrect.

Here is what I have done:

  • Right-click in project view, Import New Asset…, select the image.
  • Change settings on the image in Inspector View. (Note: tutorial author doesn’t seem to have the Sprite Mode option due to an older Unity version. Mine is Unity 4.5 (latest) and was set to Single by default, but I changed it to None. Not sure if this is correct). Click APPLY.

As you can see, the result is just a blank (and very dark) square. No uv image seems to have been applied. How do I get this to work?

As a side question, I also played with the Sprite Editor. If I select Multiple for the Sprite Mode, I can create individual sprites by defining a grid on the spritesheet image. Is there a way to map these defined individual sprites to the mesh I’m generating in the code from the tutorial?

In other words, instead of importing the image the way the tutorial author has done it, could I use Unity’s new Sprite Editor system to map the UV to the square mesh? If so, would it be very inefficient for mapping to many square meshes (would it scale to a large tiled world)?

Added code:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class PolygonGenerator : MonoBehaviour {
	public List<Vector3> newVertices = new List<Vector3>();
	public List<int> newTriangles = new List<int>();
	public List<Vector2> newUV = new List<Vector2>();
	private Mesh mesh;

	public float tUnit = 0.25f;
	private Vector2 tStone = new Vector2(0,0);
	private Vector2 tGrass = new Vector2(0,1);

	// Use this for initialization
	void Start () {
		mesh = GetComponent<MeshFilter> ().mesh;

		float x = transform.position.x;
		float y = transform.position.y;
		float z = transform.position.z;

		newVertices.Add (new Vector3 (x, y, z));
		newVertices.Add (new Vector3 (x + 1, y, z));
		newVertices.Add (new Vector3 (x + 1, y - 1, z));
		newVertices.Add (new Vector3 (x, y - 1, z));

		newTriangles.Add (0);
		newTriangles.Add (1);
		newTriangles.Add (3);
		newTriangles.Add (1);
		newTriangles.Add (2);
		newTriangles.Add (3);

		newUV.Add(new Vector2 (tUnit * tStone.x, tUnit * tStone.y + tUnit));
		newUV.Add(new Vector2 (tUnit * tStone.x + tUnit, tUnit * tStone.y + tUnit));
		newUV.Add(new Vector2 (tUnit * tStone.x + tUnit, tUnit * tStone.y));
		newUV.Add(new Vector2 (tUnit * tStone.x, tUnit * tStone.y));

		mesh.Clear ();
		mesh.vertices = newVertices.ToArray();
		mesh.triangles = newTriangles.ToArray();
		mesh.uv = newUV.ToArray(); 
		mesh.Optimize ();
		mesh.RecalculateNormals ();
	// Update is called once per frame
	void Update () {

Solved. I was missing the material. I guess the tutorial implied its creation (I’m new to Unity. Thought I could directly apply the texture).