1

How to fix this problem in Unity "Can't add script because it is an editor script." I want to put this scripts from post processing in Unity but I can't because of this problem

2
  • Did you have a look at answers.unity.com? Commented Oct 5, 2018 at 3:50
  • Hi @WaranthornFilmerChansawang and welcome to StackOverflow. Could you show us what you have tried so far, preferably some code examples? Commented Oct 5, 2018 at 5:27

1 Answer 1

8

Unity has special folder names. One of them is "Editor". The "Editor" folder is used to place Editor scripts that executes in the Editor. It cannot be attached to a GameObject.

The error

“Can't add script because it is an editor script

means that the script you are trying to attach to a GameObject is placed in a folder or root folder named "Editor" folder. Move the script outside of the "Editor" folder and the problem should be gone.


In some cases (very rare), this problem may appear even when the script in not placed in the "Editor" folder. If this is the case then simply delete and create new script and the problem should be gone.

Note that if you're trying to drag a script from a plugin not made by you and placed in the "Editor" folder to a GameObject, you are not supposed to do that. Any script you see in plugin that's put in the "Editor" folder is no meant to be attached to a GameObject. Look for scripts outside the "Editor" folder and those are the ones you many be able to attach to your GameObject if they derive from MonoBehaviour.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.