hey everyone,
I am attempting to change the button image to a new image when something is clicked on. The code I have right now is here…
public Toggle balsaLogToggle;
public Toggle appleLogToggle;
public Toggle ashLogToggle;
public Button campFireButton;
public Image campFireOn;
public Image campFireOff;
// Use this for initialization
void Start ()
{
campFireButton = gameObject.Find ("Camp Fire Button").GetComponent<Button> ();
}
// Update is called once per frame
void Update ()
{
}
void OnClickWhatLogToBurn()
{
if(balsaLogToggle.isOn)
{
GameController.control.balsaLogs -= 1;
campFireButton = campFireOn;
}
else if(appleLogToggle.isOn)
{
GameController.control.appleLogs -= 1;
campFireButton = campFireOn;
}
else if(ashLogToggle.isOn)
{
GameController.control.ashLogs -= 1;
campFireButton = campFireOn;
}
}
}
I am receiving this error message
Assets/LightLogScript.cs(33,25): error CS0029: Cannot implicitly convert type UnityEngine.UI.Image' to UnityEngine.UI.Button’
my question is what should i be using instead of the public Image to work with the button images? Am I just thinking through the logic on this the wrong way, or would this idea work if I was using the correct type instead of UnityEngine.UI.Image ? thanks!