Help!! I have been trying to fix this for hours now and can’t find out how to do it
The original code was this
using UnityEngine;
using UnityEngine.SceneManagement;
public class LoadGame : MonoBehaviour {
public Texture2D playNormal;
public Texture2D playHover;
void OnMouseEnter(){
GetComponent<GUITexture>().texture = playHover;
}
void OnMouseExit(){
GetComponent<GUITexture>().texture = playNormal;
}
void OnMouseDown()
{
//Nilupul
//SaveGame.Instance.Load();
SaveGame.Instance.IsSaveGame = true;
SceneManager.LoadScene ("Test");
}
// Use this for initialization
void Start () {
}
}
I tried doing what it told me “Use UI.Image instead” And still didnt work, it just said "the type or namespace “UI could not be found (are you missing a using directive or an assembly reference?”
This is the code after I tried fixing it
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class LoadGame : MonoBehaviour {
public Texture2D playNormal;
public Texture2D playHover;
void OnMouseEnter(){
GetComponent<UI.Image>().texture = playHover;
}
void OnMouseExit(){
GetComponent<UI.Image>().texture = playNormal;
}
void OnMouseDown()
{
//Nilupul
//SaveGame.Instance.Load();
SaveGame.Instance.IsSaveGame = true;
SceneManager.LoadScene ("Test");
}
// Use this for initialization
void Start () {
}
}
,This is the code
using UnityEngine;
using UnityEngine.SceneManagement;
public class LoadGame : MonoBehaviour {
public Texture2D playNormal;
public Texture2D playHover;
void OnMouseEnter(){
GetComponent<GUITexture>().texture = playHover;
}
void OnMouseExit(){
GetComponent<GUITexture>().texture = playNormal;
}
void OnMouseDown()
{
//Nilupul
//SaveGame.Instance.Load();
SaveGame.Instance.IsSaveGame = true;
SceneManager.LoadScene ("Test");
}
// Use this for initialization
void Start () {
}
}
This is what I did that it told me to, but still didn’t work, pls help
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class LoadGame : MonoBehaviour {
public Texture2D playNormal;
public Texture2D playHover;
void OnMouseEnter(){
GetComponent<UI.Image>().texture = playHover;
}
void OnMouseExit(){
GetComponent<UI.Image>().texture = playNormal;
}
void OnMouseDown()
{
//Nilupul
//SaveGame.Instance.Load();
SaveGame.Instance.IsSaveGame = true;
SceneManager.LoadScene ("Test");
}
// Use this for initialization
void Start () {
}
}
All it said after doing what I was told was “The type or namespace name UI could not be found (are you missing a using directive or an assembly reference?)”