Error in my program, Trying to make a button work

I am writing a program to make a button work, and am following a tutorial. I get error CS1022: Type or namespace definition, or end-of-file expected whenever I try to run it.

code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ButtonBehaviour : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
   public class ButtonBehaviour : MonoBehaviour
{
    int n;
    public void OnButtonPress()
    {
        n++;
        Debug.Log("Button clicked " + n + " times.");
    }
}

}
}

// Update is called once per frame
void Update()
{
    
}
}


Read more here: https://stackoverflow.com/questions/67508864/error-in-my-program-trying-to-make-a-button-work

Content Attribution

This content was originally published by Phillip Shukhnov at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: