Skip to content

Instantly share code, notes, and snippets.

@taibenvenuti
Created May 6, 2017 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taibenvenuti/ad03ecdb00cb8d8311fd88c27159012d to your computer and use it in GitHub Desktop.
Save taibenvenuti/ad03ecdb00cb8d8311fd88c27159012d to your computer and use it in GitHub Desktop.
Serializable Color
[Serializable]
public class SerializableColor
{
public float r;
public float g;
public float b;
public float a;
public SerializableColor()
{
}
public SerializableColor(Color color)
{
r = color.r;
g = color.g;
b = color.b;
a = color.a;
}
public static implicit operator Color(SerializableColor color)
{
return new Color(color.r, color.g, color.b, color.a);
}
public static implicit operator SerializableColor(Color color)
{
return new SerializableColor(color);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment