c# - Why can't I add the script to my Game Object? - Stack Overflow

So I recently got an asset from the Unity Asset Store that's mean to make ropes, but when I tried

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
Add a comment  | 

2 Answers 2

Reset to default 0

You 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!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745627180a4636880.html

相关推荐

  • c# - Why can't I add the script to my Game Object? - Stack Overflow

    So I recently got an asset from the Unity Asset Store that's mean to make ropes, but when I tried

    12小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信