Why is my gui button goign off right when I start my game?

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 :slight_smile:

Start is already a method in use by unity, it gets called immediately after starting the game
Choose another name Like StartGame or something and check out this list:

if you want to see which methodnames are safe to use

1 Like