Search Issue Tracker
Duplicate
Votes
2
Found in
4.2.0f4
Issue ID
561931
Regression
No
A monobehaviour can't be in a namespace and have optional parameters in its method signature at the same time
To reproduce:
1. Open the project
2. Add TestComponent to a game object. It will fail.
3. Remove the default parameter to TestFunction ("=false") or remove the namespace to add the script.
Identified as duplicate of 496529.
Comments (3)
-
ilya_ca
Sep 29, 2014 02:32
The issue is still present on Mac OS X in Unity 4.5.
-
randomtiger
Mar 21, 2014 19:57
I'll never get those two hours of my life back
-
codestage
Dec 06, 2013 07:44
Looks like 4.3.1 has regression for this.
Just attach this MonoBehavior script:
using UnityEngine;namespace Assets.UnityBug
{
public class Bug: MonoBehaviour
{private void someMethod(int param = 10)
{
Debug.Log(param);
}
}
}and you'll see this error after starting simulation:
The class defined in script file named 'Bug' does not match the file name!Change private void someMethod(int param = 10) to private void someMethod(int param) and it will run fine!
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
- SIGSEGV error when adding EditorApplication.delayCall callback declared in complex generic type and exiting Unity in `Performanc
- Resize cursor does not appear while approaching window edge from inside the player window when using Input System as the Input Handler
- IMGUI Debugger Instructions are flickering when the Inspected View is set to Scene and mouse cursor is moved over the Scene View
- [Windows] “GUI Window tried to begin rendering while something else had not finished rendering!…” Error is thrown after opening “Insert a template into current VFX Asset” window
- No InvalidOperationException error thrown when Active Input Handling is set to "Input System package" and "OnMouseDown()" is triggered
This is a duplicate of issue #496529