"Type or namespace definition, or end-of-file expected" (857850)

Assets\Ball Fight\Scripts\Controller\Scripts\Controller\FloatingJoystickEditor.cs(30,1): error CS1022: Type or namespace definition, or end-of-file expected

UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in <97ba64834c8f4edc84e3d8e30b04f122>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <97ba64834c8f4edc84e3d8e30b04f122>:0
UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

There is no problem when ı starting game in editor but when ı want to build, i get this mistake. How can ı solve these problems ? Thanks

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

[CustomEditor(typeof(FloatingJoystick))]
public class FloatingJoystickEditor : JoystickEditor
{
  #if UNITY_EDITOR
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        if (background != null)


        {
            RectTransform backgroundRect = (RectTransform)background.objectReferenceValue;
            backgroundRect.anchorMax = Vector2.zero;
            backgroundRect.anchorMin = Vector2.zero;
            backgroundRect.pivot = center;
        }

  #endif
    }


}

The reason for this compile error is because your #if block encompasses unbalanced brackets { } if you imagine the script without the content inside those blocks (which is what the compiler sees when building the standalone), you have one more } than {

However, an editor script ought to not need these #if’s at all, because editor scripts should be in an Editor folder. Editor folders don’t get compiled at all for builds. So, remove the #if’s, and move the script into a folder named Editor

Thank you very much. You made my day much better.