Created
May 21, 2016 17:11
-
-
Save StollD/afe27970392323cb564d6fffade61a8f to your computer and use it in GitHub Desktop.
Unity datatypes, serializeable with Protobuf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ProtoContract] | |
public struct ProtoVector3d | |
{ | |
// Vector3 definitions | |
[ProtoMember(1)] public Double x; | |
[ProtoMember(2)] public Double y; | |
[ProtoMember(3)] public Double z; | |
// Convert Vector3d to ProtoVector3d | |
public static implicit operator ProtoVector3(Vector3d input) | |
{ | |
return new ProtoVector3d | |
{ | |
x = input.x, | |
y = input.y, | |
z = input.z | |
}; | |
} | |
// Convert ProtoVector3d to Vector3d | |
public static implicit operator Vector3d(ProtoVector3 input) | |
{ | |
return new Vector3d | |
{ | |
x = input.x, | |
y = input.y, | |
z = input.z | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment