So my original Code was:
void Update()
{
buyButton.onClick.AddListener(buyItem);
}
When I hold the button (for like half a second), nothing gets printed from the Debug.Log line in the buyItem Function. However, when I release it, hundreds of messeges get printed out, and it seems that there are more messeges the longer I hold.
How can I make it so that the function only activates when the button gets released?