There are many ways to solve this. First one is taht you can operate on Tags:
Debug.Log(gameObject.Tag == "YesButton" ? "Yes" : "No");
But (imo) dealing with tags is painfull so the easiest way would be to just make some enumeration (for future improvements like "Yes", "No", "Cancel" etc.)
public enum ButtonType : byte {
YES = 0,
NO = (1 << 0)
}
// inside your button code
[SerializeField]
ButtonType _myType;
public ButtonType Type { get { return _myType; } }
EDIT:
Usage with Unity's event
// inside ButtonScript.Start() or ButtonScript.Awake()
this/* Button */.onClick.AddListener(new UnityEngine.Events.UnityAction(ButtonClicked));
// and now make a new method inside ButtonScript
void ButtonClicked()
{
// method with tags:
Debug.Log(gameObject.Tag == "YesButton" ? : "Yes" : "No");
// method with enumeration:
Debug.Log(_myType.ToString());
}