How to get name of a button which clicked.

Hi !
Am making card game which is multiplayer
I made the all cards clickable by adding button, now i wanna know when the player selected any card I’II know which card(button) and which player selected that card

Thanks !

You can add a listener in the script or add a listener in the Inspector.

Unity Tutorials - UI

UnityEngine.UI.Button button;

public void Awake()
{
	button = GetComponent<UnityEngine.UI.Button>();
	button.onClick.AddListener( () => {OutputName();} );
}

void OutputName()
{
	Debug.Log(name);
}