I’m trying to use a Texture2D with UnityGUI to create a button with an icon. However, Unity says that it can’t find the namespace for Texture2D. I looked up the namespace and it says it is UnityEngine which I am using I think:
using UnityEngine;
So what am I missing here? How do I use Texture2D? Here is my code:
using UnityEngine;
using System.Collections;
public class ButtonScript : MonoBehaviour {
public Texture2d icon;
// Use this for initialization
void Start () {
}
void OnGUI()
{
if (GUI.Button (new Rect (10, 10, 10, 10), icon))
Application.LoadLevel ("LevelSelectScreen");
}
// Update is called once per frame
void Update () {
}
}