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
- Standalone Player crashes with "TDerived GetOrLoad<TDerived>() where TDerived : T" when IL2CPP Code generation is set to "Faster (smaller) Builds"
- IndexOutOfRangeException and InvalidOperationException when logging XML string
- Script missing in "Assets/Settings/Mobile_Renderer/GlobalVolumeFeature" of "com.unity.template.urp-blank" template
- “Font Asset Creator - Error Code [Invalid_File_Structure]…“ error is logged when generating Font Assets from fonts with meta files from previous Editor versions
- Input.mousePosition returns (NaN, NaN, 0.00) when Scene view is opened
Add comment