mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 11:57:40 +02:00
finally fix deserialization of the new format
This commit is contained in:
@ -36,30 +36,5 @@ namespace HeavenStudio
|
||||
this.max = max;
|
||||
}
|
||||
}
|
||||
|
||||
// https://answers.unity.com/questions/772235/cannot-serialize-color.html
|
||||
// i am crying
|
||||
[System.Serializable]
|
||||
public class SerializableColor
|
||||
{
|
||||
public float[] colorStore = new float[4] { 1F, 1F, 1F, 1F };
|
||||
public UnityEngine.Color Color
|
||||
{
|
||||
get { return new Color(colorStore[0], colorStore[1], colorStore[2], colorStore[3]); }
|
||||
set { colorStore = new float[4] { value.r, value.g, value.b, value.a }; }
|
||||
}
|
||||
|
||||
//makes this class usable as Color, Color normalColor = mySerializableColor;
|
||||
public static implicit operator UnityEngine.Color(SerializableColor instance)
|
||||
{
|
||||
return instance.Color;
|
||||
}
|
||||
|
||||
//makes this class assignable by Color, SerializableColor myColor = Color.white;
|
||||
public static implicit operator SerializableColor(UnityEngine.Color color)
|
||||
{
|
||||
return new SerializableColor { Color = color };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user