using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class LegBtn : MonoBehaviour { public Sprite on, off; Image img; // Start is called before the first frame update void Start() { img = GetComponent(); } public void changeSprite(bool b) { if (!b) { img.sprite = on; Debug.Log(" ta ON"); } else { img.sprite = off; Debug.Log(" ta off"); } } }