Reputation: 99
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
Upvotes: 1
Views: 7233
Reputation: 125305
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
.
Upvotes: 7