diff options
author | Shuhei Tanuma <chobieee@gmail.com> | 2015-11-06 07:47:39 +0900 |
---|---|---|
committer | Shuhei Taunma <chobieee@gmail.com> | 2015-11-17 18:02:59 +0900 |
commit | 37e28d98ea1ef178e32be6acc0c5911a616ba021 (patch) | |
tree | e461c92c913ea4658138d482948c796bfd2e2a40 /tests/MyGame | |
parent | 097797bf9fe7913b503be8b9a455177cefd44b46 (diff) | |
download | flatbuffers-37e28d98ea1ef178e32be6acc0c5911a616ba021.tar.gz flatbuffers-37e28d98ea1ef178e32be6acc0c5911a616ba021.tar.bz2 flatbuffers-37e28d98ea1ef178e32be6acc0c5911a616ba021.zip |
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) {
```
Diffstat (limited to 'tests/MyGame')
-rw-r--r-- | tests/MyGame/Example/TestSimpleTableWithEnum.cs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/MyGame/Example/TestSimpleTableWithEnum.cs b/tests/MyGame/Example/TestSimpleTableWithEnum.cs index 9b436ffd..245d3300 100644 --- a/tests/MyGame/Example/TestSimpleTableWithEnum.cs +++ b/tests/MyGame/Example/TestSimpleTableWithEnum.cs @@ -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); |