Search Issue Tracker

Postponed means that the issue was either a feature request or something that requires major refactoring on our side. Since that makes the issue not actionable in the close future we choose to close it as Postponed and add it on our internal roadmaps and technical debt pages instead.

Postponed

Votes

0

Found in

5.3.2f1

Issue ID

792416

Regression

No

[Scripting] Using namespace with optional arguments prevents discovery of MonoBehaviour class

Scripting

-

Steps to reproduce:
1. Open the attached project 'case-792416-MonoBehavior_Discovery'
2. Click the 'CannotFindBehaviour' script in Assets and check the Inspector window
3. Notice the message 'No MonoBehavior scripts in the file...'
4. Repeat step 2 with the script 'Copy'

Note: Scripts 'Copy' and 'CannotFindBehaviour' are identical, except that 'struct PreventsDiscovery{}' and 'public class CannotFindBehaviour' have switched places.

5. Notice the message 'No MonoBehavior scripts in the file...' in the Inspector is no longer present
6. Open the 'CannotFindBehaviour' script
7. In line 5 remove "=1"
8. Step 5

Expected: MonoBehavior should be discovered in both scripts

Workaround: Writing the MonoBehavior class before struct

Reproduced with:
5.4.0b17, 5.3.4p5, 5.2.3p3, 5.1.3p3 (Windows 10)

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.