Search Issue Tracker

Fixed in 2022.1.X

Fixed in 2019.1.X, 2020.3.X, 2021.1.X



Found in






Issue ID




Incorrect error dialog appears when trying to attach script with spaces in the file name



How to reproduce:
1. Create a new project
2. In the Project window create a new C# script and name it "test script" (with the space)
3. Try to drag the newly created script on the "Main Camera" GameObject

Expected result: An error dialog appears with the following message "Can't add script component 'test script' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match."
Actual result: An error dialog appears with the following message: "The script test script' does not contain a class derived from UnityEngine.MonoBehaviour"

Reproducible with: 2018.4.34f1, 2020.3.7f1, 2021.1.6f1, 2021.2.0a17
Not reproducible with: 2019.2.0a3, 2019.4.26f1

1. Reproducible on Windows 10 and Ubuntu 18.04
2. The issue was previously fixed in 2019.2.0a3 but regressed again
3. On 2020.2.0a1, 2020.2.0a8 the script can be attached but doesn't load
4. Messages on different Editor versions:
2018.4.34f1: Can' add script AssemblyInfo.cs. The script needs to derive from MonoBehaviour!
2020.3.7f1: The script don't inherit a native class that can manage a script.
2021.1.6f1, 2021.2.0a17: The script 'gg hh' does not contain a class derived from UnityEngine.MonoBehaviour

  1. Resolution Note (fix version 2022.1):

    Fixed in 2021.2.0a19

  2. Resolution Note (fix version 2021.1):

    Fixed in 2021.1.13f1

  3. Resolution Note (fix version 2020.3):

    Fixed in 2020.3.13f1

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.