Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Error: No MonoBehaviour Scripts in the file

Discussion in 'Editor & General Support' started by Mikad0, Nov 20, 2018.

  1. Mikad0

    Mikad0

    Joined:
    Nov 20, 2018
    Posts:
    4
    I'm following the 2D Roguelike tutorial, but I can't add the scripts to the GameObject. I see the following error in the scripts: "No MonoBehaviour scripts in the file, or their names do not match the file name".

    The public class has the same name as the file, it as MonoBehaviour, everything looks ok:
    https://imgur.com/1TlFGIC
    https://imgur.com/IXN5DtT

    Thoughts?
     
  2. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,923
    I see some red in the visual studio, do you have compile errors?
     
    Mikad0 and Joe-Censored like this.
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    I think you need to scroll down and fix those script errors that VS is complaining about first.
     
  4. Mikad0

    Mikad0

    Joined:
    Nov 20, 2018
    Posts:
    4
    That's it! I had some errors. Thanks!
     
    Lurking-Ninja likes this.