Named arguments are not supported in UdonSharp
Description
When using named arguments in UdonSharp, the code compiles successfully but does not behave like standard C#.
It seems that default parameter values are applied instead of the explicitly provided named arguments.
Minimal Example
using UdonSharp;
using UnityEngine;
public class ScriptTesting : UdonSharpBehaviour
{
void Start()
{
// Passing "value2: false" explicitly
NamedArgumentsTest(1, value2: false);
}
private void NamedArgumentsTest(int dummy, bool value = true, bool value2 = true)
{
if (value)
Debug.Log("Value is TRUE!");
else
Debug.Log("Value is FALSE!");
if (value2)
Debug.Log("Value2 is TRUE!");
else
Debug.Log("Value2 is FALSE!");
}
}
Expected Output
Value is TRUE!
Value2 is FALSE!
Actual Output
Value is TRUE!
Value2 is TRUE!
Notes
-
The function call compiles, but the named argument is ignored, and the default parameter value is used instead.
-
This behavior is inconsistent with standard C# and can cause confusion.
Suggestion
If supporting named arguments is not possible due to UdonSharp's design, it would be clearer to emit a compile-time error instead of silently ignoring them.
This would prevent unexpected behavior for developers.
Environment
- SDK: VRChat SDK 3.8.2
- Unity: 2022.3.22f1
Named arguments are not supported in UdonSharp
Description
When using named arguments in UdonSharp, the code compiles successfully but does not behave like standard C#.
It seems that default parameter values are applied instead of the explicitly provided named arguments.
Minimal Example
Expected Output
Actual Output
Notes
The function call compiles, but the named argument is ignored, and the default parameter value is used instead.
This behavior is inconsistent with standard C# and can cause confusion.
Suggestion
If supporting named arguments is not possible due to UdonSharp's design, it would be clearer to emit a compile-time error instead of silently ignoring them.
This would prevent unexpected behavior for developers.
Environment