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.5f1
Issue ID
807536
Regression
No
Function overloading with and optional arguments
An odd C# behaviour in our editor.
Steps to reproduce:
- Create two functions in a file like:
private void TestFunc(object value, Action action = null)
and
private void TestFunc(object[] value, Action action = null)
- Unity logs the error:
Assets/TestScript.cs(18,10): error CS0121: The call is ambiguous between the following methods or properties: 'TestScript.TestFunc(object, System.Action)' and 'TestScript.TestFunc(object[], System.Action)'
- When getting rid of the default valued paratemers, it doesn't show the error. Example"
private void TestFunc(object value)
and
private void TestFunc(object[] value)
Tested on Unity 5.3.5f1, 5.4.0b24, and 5.2.5f1; using Monodevelop 5.9.6 on Mac.
This is valid C# code.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Graphics Settings shows default values instead of the real values in the Rendering Debugger when Volume.profile is assigned via script
- Deleting multiple Tags throws “NullReferenceException”, and "Retrieving array element that was out of bounds" errors when holding the Enter key
- Material Component has two horizontal lines under it when its foldouts are closed
- Some selected Mesh Renderer Materials lead to Assets folder when pinged
- Editor colors appear darkened out when HDR Display Output is enabled
Add comment