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

Namespace UnityEditor?

Discussion in 'Linux' started by Fra123X, Sep 9, 2015.

  1. Fra123X

    Fra123X

    Joined:
    Mar 10, 2013
    Posts:
    40
    Now I don't know if I am missing anything, but after compiling a game I got the error
    Code (Error):
    1. "The type or namespace name `UnityEditor' could not be found. Are you missing a using directive or an assembly reference?"
     
  2. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,384
    Compiler strips UnityEditor.

    Use...

    Code (csharp):
    1.  
    2. #if UNITY_EDITOR
    3. using UnityEditor;
    4. #endif
    5.  
    6. ...
    7.  
    Also need to do that for any editor code inside your runtime scripts.
     
    Fra123X likes this.
  3. Fra123X

    Fra123X

    Joined:
    Mar 10, 2013
    Posts:
    40
    Thanks for that, seems to be working fine :)
     
    LaneFox likes this.