mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-08 14:15:17 +00:00
C# Unity can't cast integer represented enum value.
```
namespace MyGame;
enum CommandType : byte {
None = 0,
}
table Command {
id:int;
type:CommandType;
}
```
then generate c# files. it'll output compile error like these.
```
Assets/MyGame/Command.cs(18,39): error CS1041: Identifier expected
Assets/MyGame/Command.cs(18,39): error CS1737: Optional parameter cannot precede required parameters
16: public static Offset<Command> CreateCommand(FlatBufferBuilder builder,
17: int id = 0,
18: CommandType type = (CommandType)0) {
```
This commit is contained in:
committed by
Shuhei Taunma
parent
097797bf9f
commit
37e28d98ea
@@ -14,7 +14,7 @@ public sealed class TestSimpleTableWithEnum : Table {
|
||||
public bool MutateColor(Color color) { int o = __offset(4); if (o != 0) { bb.PutSbyte(o + bb_pos, (sbyte)color); return true; } else { return false; } }
|
||||
|
||||
public static Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(FlatBufferBuilder builder,
|
||||
Color color = (Color)2) {
|
||||
Color color = Color.Green) {
|
||||
builder.StartObject(1);
|
||||
TestSimpleTableWithEnum.AddColor(builder, color);
|
||||
return TestSimpleTableWithEnum.EndTestSimpleTableWithEnum(builder);
|
||||
|
||||
Reference in New Issue
Block a user