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

Scripting

-

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.

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.