Type mapping
In tier 2 (and generated code), protobuf types convert to and from Godot
Variant types as follows.
| Proto type | Godot type |
|---|---|
double, float | float |
int32, sint32, sfixed32 | int |
int64, sint64, sfixed64 | int |
uint32, fixed32 | int |
uint64, fixed64 | int |
bool | bool |
string | String |
bytes | PackedByteArray |
enum | int (the enum value) |
| message | GrpcMessage |
repeated T | Array |
map<K, V> | Dictionary |
Notes
- 64-bit unsigned integers: values above
2^63 - 1do not fit in Godot’s signed 64-bitintand will wrap. Usestringfields for very large numbers if exact representation matters. - Nested messages are
GrpcMessageinstances. When setting a message field you may pass either aGrpcMessageor a plainDictionary. GrpcMessage.to_dict()converts a whole message (recursively) to aDictionary;get_field/set_fieldwork field-by-field.- Unset fields read back as their protobuf defaults (0,
"", empty array, etc.).