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

Editor - Other

-

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)

  1. 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!"

  2. 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.

Add comment

Log in to post comment