Hello, l have a problem getting my texture / material to apply when a collision event happens. I am not sure why this is not working. My C# Script is below, thank you for any help:

using UnityEngine;
using System.Collections;

public class CubeCollision : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	void OnCollisionEnter (Collision cul)
	{
		if (cul.gameObject.name == "PlayerCube")
			GetComponent<Renderer>().material.mainTexture = ColourRed;
	}
}

Sorry for wasting time, but l have done it now, however l can still share my fix, l just need to add this code at the top like so:

using UnityEngine;
using System.Collections;

public class CubeCollision : MonoBehaviour {
	public Texture ColourRed;