Search Issue Tracker
Duplicate
Votes
0
Found in
5.1.0b6
Issue ID
695569
Regression
No
[EditorScript] Wrong error message when trying to attach a script from Editor folder to a game object
Steps to reproduce:
1. Open the attached project
2. Click the menu button Test\AddScript
3. Notice it will create a game object and it will try to add a script from Editor folder to it
4. Notice the message in the console: "Can't add script behaviour . The script needs to derive from MonoBehaviour!"
5. But the script is actually derived from MonoBehaviour. Therefore the message should say that such a script can not be attached to a game object because it is an editor script, not because it has to derive from MonoBehaviour. (Something similar as when you try to manually attach editor script to a GO, you then get "Can't add script. The script is an editor script.")
Comments (2)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- TextShadow properties are not applied when displayed in a custom MenuItem Window
- Memory leak occurs when focused on Player while using Direct3D12
- var VisionOSEDRHeadromm has a comma instead of a dot when building with Metal Rendering App Mode and local OS localization is set to German
- IAP Catalog remove product “x” and add product “+” buttons are not consistent with other remove and add buttons in the Editor
- Performance issues in Play Mode when quickly hovering the mouse cursor over Hierarchy GameObjects
hwilliams
Jul 16, 2016 05:32
I'm not sure if this is the same issue, but I followed the "Unity - Building A Custom Inspector" tutorial here http://unity3d.com/learn/tutorials/topics/interface-essentials/building-custom-inspector?playlist=17117 and got the following error when trying to apply the script to an empty gameObject:
"Can't add script behaviour LevelScriptEditor. The script needs to derive from MonoBehaviour!"
doug__
Jan 23, 2016 07:02
Any chance we could get a link to the issue that this duplicates so I can vote on it?
I just wasted an hour writing unit tests with this bug.