Instance of [Editor] couldn't be created because there is no script with that name.

Hello all,

I'm getting this error only when I try to build and run. The error doesn't come up when I run the game within Unity.

Instance of FXSenderEditor couldn't be created because there is no script with that name. UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

This is the relevant section from the editor log report:

Unloading 282 unused Assets to reduce memory usage. Loaded Objects now: 3224. System memory in use: 296.8 MB. Unloading 25 Unused Serialized files (Serialized files now loaded: 2 / Dirty serialized files: 2) Instance of FXSenderEditor couldn't be created because there is no script with that name. UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, BuildTarget, BuildOptions) UnityEditor.BuildPlayerWindow:BuildPlayerWithDefaultSettings(Boolean, BuildOptions) (at C:\BuildAgent\work\6bc5f79e0a4296d6\Editor\Mono\BuildPlayerWindow.cs:339) UnityEditor.BuildPlayerWindow:BuildPlayerAndRun() (at C:\BuildAgent\work\6bc5f79e0a4296d6\Editor\Mono\BuildPlayerWindow.cs:263)

[C:/BuildAgent/work/6bc5f79e0a4296d6/Runtime/Mono/MonoExportUtility.cpp line 781] (Filename: C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Mono/BuildPlayerWindow.cs Line: 339)

This is FXSenderEditor.cs, which is in Assets/Editor:

using UnityEditor;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

[CustomEditor(typeof(FXSender))] 
public class FXSenderEditor : Editor 

{
    private bool foldoutDefault=false;

    public override void OnInspectorGUI()
    {
        FXSender theScript = (FXSender)target;
        EditorGUIUtility.LookLikeInspector();
        //...

Have scoured the web and not really found an answer. Any ideas?

I had a very similar issue when making builds with a custom “Editor” selected. I used “Selection.activeGameObject = null;” before the build and it fixed this issue.