Created
May 6, 2017 23:41
-
-
Save taibenvenuti/ad03ecdb00cb8d8311fd88c27159012d to your computer and use it in GitHub Desktop.
Serializable Color
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
[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