Read the documentation but still having a problem getting the following to work. Basically trying to simulate Toggles and ToggleGroup using Buttons. I have ‘Disabled Sprite’ defined properly for offButton1 and offButton2.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ToggleButton : MonoBehaviour {
private bool ButtonOn = false;
public Button MyButton;
public Button offButton1;
public Button offButton2;
public Sprite pressedSprite;
public Sprite disabledSprite;
public SpriteState sprState = new SpriteState();
public void BeenClicked()
{
if(MyButton.image.sprite !=pressedSprite)
{
//MyButton.image.color = Color.red;
MyButton.image.sprite = pressedSprite;
offButton1.spriteState = sprState.disabledSprite;
offButton2.spriteState = sprState.disabledSprite;
}
}
}