UdonSharp Enum as optional argument causes compile errors
Marro64
Having an enum as an optional argument to a method causes compile errors. The errors show up as
[UdonSharp] Assets/Scripts/Test.cs(12,1): System.ArgumentException: Type provided must be an Enum.
with the code location in the errors being seemingly random and unrelated.Code to replicate bug:
enum AnEnum {
Option,
AnotherOption
}
public class Test : UdonSharpBehaviour
{
void OptionalEnum(AnEnum anEnum = AnEnum.Option)
{
}
}
Changing
void OptionalEnum(AnEnum anEnum = AnEnum.Option)
to void OptionalEnum(AnEnum anEnum)
removes the errors.Log In
Jar
Just bumped into this myself, this post looks old but I hope they fix this