Hi,can someone please help me? What is wrong with my cs code?Unity say Assets/Typer.cs(24,17): error CS0029: Cannot implicitly convert type `UnityEngine.UI.Text' to `UnityEngine.Texture'

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

[RequireComponent(typeof(AudioSource))]
[RequireComponent(typeof(Text))]
public class Typer : MonoBehaviour {

public string msg= "Replace";
private Texture textComp;
public float startDelay = 2f;
public float typeDelay = 0.01f;
public AudioClip putt;

void Start()
{
	StartCoroutine("TypeIn");
}

void Awake()
{
	textComp = GetComponent<Text>();
}

public IEnumerator TypeIn()
{
	yield return new WaitForSeconds(startDelay);

	for(int i = 0; i < msg.Length; i++)
	{
		textComp.text = msg.Substring (0,i);
		GetComponent<AudioSource>().PlayOneShot(putt);
		yield return new WaitForSeconds(typeDelay);
	}
}

public IEnumerator TypeOff()
{
	for (int i = msg.Length; i >= 0; i--) 
	{
		textComp.text = msg.Substring (0,i);
		yield return new WaitForSeconds(typeDelay);
	}
}

}

The answer is literally in the error message.

textComp is a Texture. You declare it as such in line 2:

private Texture textComp;

Yet, on line 15, you’re trying to assign a Text component to it:

textComp = GetComponent<Text>();

You cannot implicitly convert type UnityEngine.UI.Text to UnityEngine.Texture…