unity get button gameobject code example
Example: how to get the name of the button pressed in unity
//this is Unity pared with C#
using UnityEngine.EventSystems;
public class Class : Monobehaviour
{
//Call this function when the button is pressed
public void ButtonClicked()
{
string name = EventSystem.current.currentSelectedGameObject.name;
}
}