1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. Unity 5.6 is now released.
    Dismiss Notice
  3. Check out all the fixes for 5.5 in patch releases 1 & 2.
    Dismiss Notice
  4. Get further faster with the Unity Plus Accelerator Pack, free for new Unity Plus subscribers for a limited time. Click here for more details.
    Dismiss Notice
  5. Learn how you'll soon be able to publish your games to China in four simple steps with Xiaomi. Sign up now for early access.
    Dismiss Notice

`UnityEditor' could not be found??? Oo

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

  1. IJM

    IJM

    Joined:
    Aug 31, 2010
    Posts:
    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
    Posts:
    108
    Oh, I see now.
    It isn't in the "Editor" folder.
     
  3. TomMars

    TomMars

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

    gioworks

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

    flaminghairball

    Joined:
    Jun 12, 2008
    Posts:
    862
    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
    Posts:
    138
    Yes thanks i did it. It works
     
  7. FredMastro

    FredMastro

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

    leedime

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

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    9,111
    AndyGainey likes this.
  10. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    31,003
    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.