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
- SpeedTree meshes and objects count differs when comparing the numbers in the Player with the Editor
- Model and Prefab Preview icons are not updated after upgrading associated Materials to URP
- Game view is rendered white when viewing the Editor with HDR display and Post Proccesing is enabled on the Main Camera with 2D URP
- "GetPreferedValue" returns max value when using auto-sizing
- UI Builder doesn't update the style sheet when using "Extract inline style" right-click option
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.