Build Error

I’ve tried Reimporting all my assets (Unity only crashes), and the console keeps telling me “Error building Player because scripts had compiler errors” and “Assets/Custom/Scripts/ScoreScript.cs(5,7): error CS0246: The type or namespace name `UnityEditor’ could not be found. Are you missing an assembly reference?”

What am I doing wrong? Please help!

Thanks

Scripts that are included in a build cannot reference the UnityEditor namespace - that is only available to you when running from within the UnityEditor. If you need the editor code in that script, you can set it to only be built while in the editor using preprocessor directives:

using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

public class MyClass : MonoBehaviour {
    private void Update() {
        #if UNITY_EDITOR
            // Code that uses the UnityEditor namespace must be in
            // this #if block
        #endif
    }
}