无法添加脚本,因为它是编辑器脚本错误 [英] Can't add script because it is an editor script error

查看:137
本文介绍了无法添加脚本,因为它是编辑器脚本错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Unity 中解决此问题无法添加脚本,因为它是编辑器脚本."我想将此脚本从后处理中放入 Unity,但由于这个问题我不能

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

推荐答案

Unity 有特殊的文件夹名称.其中之一是编辑器".Editor"文件夹用于放置在编辑器中执行的编辑器脚本.它不能附加到游戏对象上.

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.

错误

无法添加脚本,因为它是编辑器脚本

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

表示您尝试附加到 GameObject 的脚本位于名为Editor"文件夹的文件夹或根文件夹中.将脚本移到编辑器"文件夹之外,问题应该消失了.

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.

请注意,如果您尝试将脚本从不是您制作的插件并放置在编辑器"文件夹中拖动到游戏对象,您不应该这样做.您在插件中看到的放在编辑器"文件夹中的任何脚本并不意味着附加到游戏对象.在编辑器"文件夹之外查找脚本,如果它们派生自 MonoBehaviour,那么您可以将这些脚本附加到您的 GameObject.

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.

这篇关于无法添加脚本,因为它是编辑器脚本错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆