admin管理员组文章数量:1025620
So I recently got an asset from the Unity Asset Store that's mean to make ropes, but when I tried to use it, It said it couldn't add the script to the game object?
This was the error:
Can't add script component 'RopeEditor' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match.
And This was the Important part of the code (I think for this error anyways)
using UnityEngine;
using UnityEditor;
namespace GogoGaga.OptimizedRopesAndCables
{
[CustomEditor(typeof(Rope))]
public class RopeEditor : Editor
{
If anyone could help me understand the problem and help me try to fix that'd be great because I'd rather tamper than try to find something else.
So I recently got an asset from the Unity Asset Store that's mean to make ropes, but when I tried to use it, It said it couldn't add the script to the game object?
This was the error:
Can't add script component 'RopeEditor' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match.
And This was the Important part of the code (I think for this error anyways)
using UnityEngine;
using UnityEditor;
namespace GogoGaga.OptimizedRopesAndCables
{
[CustomEditor(typeof(Rope))]
public class RopeEditor : Editor
{
If anyone could help me understand the problem and help me try to fix that'd be great because I'd rather tamper than try to find something else.
Share Improve this question asked Nov 18, 2024 at 10:12 DuckieIsADevDuckieIsADev 112 bronze badges 1- 3 Because it is an editor class not a monobehavior – BugFinder Commented Nov 18, 2024 at 10:51
2 Answers
Reset to default 0You want to add the Rope
component to your GameObject!
This RopeEditor
just controls how the Inspector of that Rope
component will then look like.
You can add a script to a GameObject if the class is derived from MonoBehaviour.
In this case:
public class RopeEditor : Editor
The class "RopeEditor" is derived from "Editor". There is probably a script called "Rope" which can be added to your game objects. Good luck!
So I recently got an asset from the Unity Asset Store that's mean to make ropes, but when I tried to use it, It said it couldn't add the script to the game object?
This was the error:
Can't add script component 'RopeEditor' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match.
And This was the Important part of the code (I think for this error anyways)
using UnityEngine;
using UnityEditor;
namespace GogoGaga.OptimizedRopesAndCables
{
[CustomEditor(typeof(Rope))]
public class RopeEditor : Editor
{
If anyone could help me understand the problem and help me try to fix that'd be great because I'd rather tamper than try to find something else.
So I recently got an asset from the Unity Asset Store that's mean to make ropes, but when I tried to use it, It said it couldn't add the script to the game object?
This was the error:
Can't add script component 'RopeEditor' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match.
And This was the Important part of the code (I think for this error anyways)
using UnityEngine;
using UnityEditor;
namespace GogoGaga.OptimizedRopesAndCables
{
[CustomEditor(typeof(Rope))]
public class RopeEditor : Editor
{
If anyone could help me understand the problem and help me try to fix that'd be great because I'd rather tamper than try to find something else.
Share Improve this question asked Nov 18, 2024 at 10:12 DuckieIsADevDuckieIsADev 112 bronze badges 1- 3 Because it is an editor class not a monobehavior – BugFinder Commented Nov 18, 2024 at 10:51
2 Answers
Reset to default 0You want to add the Rope
component to your GameObject!
This RopeEditor
just controls how the Inspector of that Rope
component will then look like.
You can add a script to a GameObject if the class is derived from MonoBehaviour.
In this case:
public class RopeEditor : Editor
The class "RopeEditor" is derived from "Editor". There is probably a script called "Rope" which can be added to your game objects. Good luck!
本文标签: cWhy can39t I add the script to my Game ObjectStack Overflow
版权声明:本文标题:c# - Why can't I add the script to my Game Object? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745627179a2159935.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论