Skip to content

Instantly share code, notes, and snippets.

@StollD
Created May 21, 2016 17:11
Show Gist options
  • Save StollD/afe27970392323cb564d6fffade61a8f to your computer and use it in GitHub Desktop.
Save StollD/afe27970392323cb564d6fffade61a8f to your computer and use it in GitHub Desktop.
Unity datatypes, serializeable with Protobuf
[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