101

101

zhiyi
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4. public class toggleButton : MonoBehaviour {
  5. public bool ButtonOn = false;
  6. public Button MyButton;
  7. public void BeenClicked()
  8. {
  9. ButtonOn = !ButtonOn;
  10. if(ButtonOn)
  11. {
  12. MyButton.image.color = Color.red;
  13. }
  14. else
  15. {
  16. MyButton.image.color = Color.white;
  17. }
  18. }
  19. }




Report Page