Games runs perfectly on editor but error on build

Games runs without any problems in the editor, but when im about to build it this error pops.

You should not use UnityEditor in a build. You can use


to surround code that should only be used in the editor (a.k.a. usage of the UnityEditor namespace)