I’ve just implemented my first gui button. Its on click () is set to a script that looks like this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class StartMatch : MonoBehaviour {
public static bool MatchStarted = false;
public void Start()
{
MatchStarted = true;
Debug.Log("Match started has been called");
}
}
The function of the on click () is set to Start(). The problem is that MatchStarted gets so to true, and the debug line is printed immediately when the game starts without any user interaction. What gives? I’m at a loss here.
Edit: Ha, I named my function Start(). Please ignore this. Of course it does something at start