I have just reopened an old project from Unity 4, and recieved quite a few errors in Unity 5. It is my play button, and even trying to use GetComponent() doesnt seem to fix it. here are the errors.
Assets/Scripts/PlayButton.js(11,9): BCE0144: ‘UnityEngine.Component.guiTexture’ is obsolete. Property guiTexture has been deprecated. Use GetComponent() instead. (UnityUpgradable)
Assets/Scripts/PlayButton.js(11,20): BCE0019: ‘texture’ is not a member of ‘UnityEngine.Component’.
Assets/Scripts/PlayButton.js(16,9): BCE0144: ‘UnityEngine.Component.guiTexture’ is obsolete. Property guiTexture has been deprecated. Use GetComponent() instead. (UnityUpgradable)
Assets/Scripts/PlayButton.js(16,20): BCE0019: ‘texture’ is not a member of ‘UnityEngine.Component’.
Here is my simple script, How can i fix the errors?
#pragma strict
var playNormal : Texture2D;
var playHover : Texture2D;
function Start () {
}
function OnMouseEnter ()
{
guiTexture.texture = playHover;
}
function OnMouseExit ()
{
guiTexture.texture = playNormal;
}
function OnMouseDown ()
{
Application.LoadLevel("spawned");
}