1. We've introduced thread tags, search within a thread and similar thread search. Read more here.
    Dismiss Notice
  2. We've released our first Timeline Experimental Preview, our new tool for creating cutscenes and more! To check it out click here.
    Dismiss Notice
  3. All Unity Pro perpetual license customers: your special offer to subscribe is ready! Click here.
    Dismiss Notice
  4. Unity 5.5 is now released.
    Dismiss Notice
  5. Check out all the fixes for 5.5 in patch releases 1 & 2.
    Dismiss Notice
  6. Unity 5.6 beta is now available for download.
    Dismiss Notice
  7. Get prepared for the Tizen Mobile App Incentive Program! Read more about the upcoming program here.
    Dismiss Notice
  8. Enter the Microsoft Developer Challenge for a chance to win prizes. Read more about it here.
    Dismiss Notice

`UnityEditor' could not be found??? Oo

Discussion in 'Scripting' started by IJM, Jan 18, 2011.

  1. IJM

    IJM

    Joined:
    Aug 31, 2010
    Messages:
    108
    This is the error in the console:
    The type or namespace name `UnityEditor' could not be found. Are you missing a using directive or an assembly reference?

    I'm using Unity 2.6.1 pro [C#]
     
  2. IJM

    IJM

    Joined:
    Aug 31, 2010
    Messages:
    108
    Oh, I see now.
    It isn't in the "Editor" folder.
     
  3. TomMars

    TomMars

    Joined:
    Dec 24, 2010
    Messages:
    4
    maybe you miss some libraries which you use,add them at the begin:using libraryName;
     
  4. gioworks

    gioworks

    Joined:
    Oct 12, 2011
    Messages:
    138
    I have same problem , can you explain this ?
     
  5. flaminghairball

    flaminghairball

    Joined:
    Jun 12, 2008
    Messages:
    861
    GIOWorks: Create a folder in your Project, name it "Editor", and drag your script into the folder.
     
    bwg3347 and Emilian0 like this.
  6. gioworks

    gioworks

    Joined:
    Oct 12, 2011
    Messages:
    138
    Yes thanks i did it. It works
     
  7. FredMastro

    FredMastro

    Joined:
    May 11, 2014
    Messages:
    4
  8. leedime

    leedime

    Joined:
    Feb 9, 2017
    Messages:
    1
  9. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Messages:
    8,751
    AndyGainey likes this.
  10. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    30,865
    It's also not a "better" answer, because in most cases when you have "using UnityEditor", you're writing an editor script, so there's going to be lots of other editor-only stuff in it, and putting "#if/#endif" around "using UnityEditor" won't help much. Generally it's best just to put editor scripts in a folder called "Editor" (doesn't have to be in the root) and call it a day. If you have a run-time script that happens to have some editor-only functionality in it, then sure, conditional compilation makes sense in that case.

    --Eric
     
    Ryiah likes this.