UdonSharp
UdonSharp copied to clipboard
Enum type parameters with a default value fail to compile.
Describe the bug in detail: When a method takes an enum type as a parameter, and also gives it a default value, UdonSharp's compiler seems to forget that it is the same enum type being passed in. (System.ArgumentException: Type provided must be an Enum.)
Provide steps/code to reproduce the bug: Declare an enum:
public enum MyEnum {
MyFirstValue, MySecondValue
}
Declare a method with that enum type as a parameter and uses a default value:
public void MyMethod(MyEnum myEnumParameter = MyEnum.MyFirstValue) {
// Method content
}
Call that method:
MyMethod(MyEnum.MySecondValue);
Expected behavior: Program compiles and runs
Additional Information: This was tested across behaviors. I did not actually test whether it happens within the same behavior.
Same problem and it happens within the same behavior.
namespace A320VAU.ND.Pages
{
// ....
public class MapDisplay : UdonSharpBehaviour
{
// ....
private void InstantiateMarkers(int range, EFISVisibilityType efisVisibilityType = EFISVisibilityType.NONE)
{
// ....
}
public void SetRange(int range) => InstantiateMarkers(range, GetVisibilityType());
public void SetVisibilityType(EFISVisibilityType visibilityType) => InstantiateMarkers(Range, visibilityType);
// ....
}
public enum EFISVisibilityType
{
CSTR,
WPT,
VORDME,
NDB,
APPT,
NONE
}
}
