- Home /
Possible Bug - Cannot remove script component from game object.
Are there any workarounds for the following?: On a game object when two or more scripts are attached, if I try to remove one of the scripts (from inspector->RemoveComponent), the wrong script gets removed. It is not possible to remove a script that is no longer needed, or (one that was erroneously attached) in cases where more than one script is attached to the game object
I haven't seen anything like that. It would be good if you made a repro case and submitted it using the bug reporter.
It is possible that one script requires the other... I think it would give you a prompt, though...
It's Unity 3.3 This particular script that I'm wanting to remove is definitely not required. But when I try to remove it, it removes the wrong script. I guess the workaround is to remove all scripts and then add and re-configure the ones needed. It might make a good case indeed. Don't know about the "bug reporter".
Try to reproduce this in as simple a scene as possible and sent in a bug including that scene, like Eric said. (Help > report a bug).
@GBStudios Yes, RequireComponent will simply prompt you that you can't remove it.
Answer by sneftel · Aug 11, 2011 at 08:22 PM
I've seen this happen when a script was renamed while still attached to a GameObject. If I recall correctly, resetting the component first (click the gear on the upper right corner of the component inspector) fixed the problem.
Answer by ptr0x · Oct 23, 2015 at 11:19 AM
I ran into the same problem here.
The problem was that all the scripts attached to a game object in unity need to contain a class inheriting from MonoBehaviour. At the moment I attached the script to the game object there was the MonoBehaviour class but after that I removed this function from my IDE, thus causing the problem described for you.
Unfortunatelly I had to delete the game object and then put the components again in it.
Your answer
Follow this Question
Related Questions
TextMeshPro Not updating Text with Rich Tags Immediately 1 Answer
Custom editor desperation: instance of custom class 1 Answer
How can I link to my docs in a Custom Inspector panel? 3 Answers
Unity Editor's Inspector Glitch while using OnGUI function 0 Answers
Components added programatically - visibility in inspector 1 Answer