Skip to content

Commit 7d2674e

Browse files
committed
fixing animation export, when the components of color property curves, are stored as x,y,z,w > we now convert the names to r,g,b,a
1 parent 7408dec commit 7d2674e

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Runtime/Scripts/SceneExporter/ExporterAnimation.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,22 @@ private void GenerateMissingCurves(float endTime, Transform tr, ref Dictionary<s
12291229
var prop = kvp.Value;
12301230
if (prop.propertyType == typeof(Color))
12311231
{
1232+
// In case of colors, but Unity uses x,y,z,w for the channel names, we convert them to r,g,b,a
1233+
for (int i = 0; i < prop.curveName.Count; i++)
1234+
{
1235+
if (prop.curveName[i].EndsWith(".x", StringComparison.Ordinal))
1236+
prop.curveName[i] = prop.curveName[i].Substring(0, prop.curveName[i].Length - 2)+ ".r";
1237+
1238+
if (prop.curveName[i].EndsWith(".y", StringComparison.Ordinal))
1239+
prop.curveName[i] = prop.curveName[i].Substring(0, prop.curveName[i].Length - 2)+ ".g";
1240+
1241+
if (prop.curveName[i].EndsWith(".z", StringComparison.Ordinal))
1242+
prop.curveName[i] = prop.curveName[i].Substring(0, prop.curveName[i].Length - 2)+ ".b";
1243+
1244+
if (prop.curveName[i].EndsWith(".w", StringComparison.Ordinal))
1245+
prop.curveName[i] = prop.curveName[i].Substring(0, prop.curveName[i].Length - 2)+ ".a";
1246+
}
1247+
12321248
var memberName = prop.propertyName;
12331249
if (TryGetCurrentValue(prop.target, memberName, out var value))
12341250
{

0 commit comments

Comments
 (0)