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. Dismiss Notice

Unity MenuItem-Error

Discussion in 'Editor & General Support' started by elephantatwork, Jul 23, 2012.

  1. elephantatwork

    elephantatwork

    Joined:
    Jul 23, 2012
    Posts:
    4
    Hi everybody

    I'm currently getting this error :
    "Assets/TK2DROOT/tk2d/Editor/Camera/tk2dCameraEditor.cs(47,6): error CS0616: `MenuItem': is not an attribute class"
    after importing any package into my project. I worked with the same package before and it worked fine, but now with the 3.5.3f3 it won't work with newely imported packages.
    I reopened the old project with 3.5.3f3 and there it worked ok.

    *edit* Reinstalling Unity even with version 3.5.4 would help *edit*



    Can anybody help?
    Thx.
     
    Last edited: Jul 24, 2012
  2. fstaber

    fstaber

    Joined:
    Sep 7, 2012
    Posts:
    2
    Simply change the name for the new MenuItem.cs file, and the name of any other references in the accompanied scripts
    (which were probably imported recently into the project)

    I ran into this, as well. I had imported a "Complete Project" from the asset store, and all of my other plugins began throwing errors for:
    "...'MenuItem' is not an attribute class"

    I looked through the new package, and noticed that they had included a MenuItem.cs file... Which is also an editor class for making custom inspector goodies..
    So, I renamed the script, and a few references to it in another script
     
    kallais and msf-eng92 like this.
  3. kallais

    kallais

    Joined:
    Jun 3, 2019
    Posts:
    11
    Thanks a lot. This worked for me.
     
  4. maxdifraia

    maxdifraia

    Joined:
    Nov 29, 2015
    Posts:
    2
    In my case I just added the UnityEditor namespace and it worked.

    From:
    [MenuItem("....")]

    To:
    [UnityEditor.MenuItem("....")]