Search Unity

Resolved What am I missing here? "No Monobehaviour scripts in the file"

Discussion in 'Scripting' started by PraetorBlue, Jun 15, 2020.

  1. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,914
    I think I've probably been staring at this too long. I could use a fresh set of eyes. I created a new ScriptableObject type, but Unity seems to think the name of the script doesn't match the name of the class. It's showing
    No MonoBehaviour scripts in the file, or their names do not match the file name
    . Therefore I'm not seeing my new type in the Create Asset Menu. As far as I can tell, the names are the same. It's
    StageDescription
    in both the filename and the class name. Any ideas?

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. [CreateAssetMenu(fileName = "New Stage Description", menuName = "Stage/Stage Description")]
    4. public class StageDescription : ScriptableObject {
    5.     public string StageName;
    6.     public string SceneName;
    7. }
    8.  
    upload_2020-6-14_22-4-15.png

    upload_2020-6-14_22-5-9.png
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,914
    Now the issue seems to have spread to another, previously working script :O

    upload_2020-6-14_22-17-48.png
     
  3. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,914
    Figured it out. I'm kicking myself. I somehow accidentally toggled off error messages in my console, so I didn't notice a completely unrelated compile error in a third, unrelated script. Fixed that error and everything started working again.
     
    Munchy2007 likes this.