- Home /
The type or namespace Editor could not be found (even though I have "using UnityEditor")
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class LogicTreeBranchEditor : Editor
{
}
Error CS0246 The type or namespace name 'Editor' could not be found (are you missing a using directive or an assembly reference?) Assembly-CSharp.Player
What am I missing here?
Answer by Hellium · Jan 20 at 08:05 AM
Classes from the UnityEditor namespace can't be packed into a build.
Make sure this class is in an Editor
folder and in an assembly definition targeting tHe Editor only.
Alternatively, if you don't want an assembly definition for this, you can wrap the script in #if UNITY_EDITOR ... #endif But either way, it needs to be in a folder called "Editor".
Answer by NiceAustralian · Jan 20 at 06:18 AM
Do you need [CustomEditor(typeof(script))]
above 'public class LogicTreeBranchEditor'.
Had that before, it was throwing an error as well. Didn't recognize "CustomEditor". I honestly think it's a VS issue.