I have a simple 2D game, I want a UI button to respawn the character (if it's not already present). The first problem I encountered is that the button only works once. I can't go any further before I solve this, so for now it doesn't spawn anything, I just want it to print debug text every time it's clicked. It only does that once, unfortunately. How do I make it call the function each time I click it?
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
public class Button_Restart : MonoBehaviour
{
public Canvas Canvas;
void Awake()
{
}
public void Restart()
{
Debug.Log("Restart button was clicked");
EventSystem.current.SetSelectedGameObject(null);
}
}