Skip to content

Commit

Permalink
sanitize alpha cutoff value before writing
Browse files Browse the repository at this point in the history
  • Loading branch information
hybridherbst committed Sep 5, 2023
1 parent 3640b03 commit 4bea36b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Runtime/Plugins/GLTFSerialization/Schema/GLTFMaterial.cs
Expand Up @@ -219,7 +219,8 @@ public override void Serialize(JsonWriter writer)
if (AlphaCutoff != 0.5)
{
writer.WritePropertyName("alphaCutoff");
writer.WriteValue(AlphaCutoff);
var sanitizedCutoff = AlphaCutoff < 0.0 ? 0.0 : AlphaCutoff > 1.0 ? 1.0 : AlphaCutoff;
writer.WriteValue(sanitizedCutoff);
}

if (DoubleSided)
Expand Down

0 comments on commit 4bea36b

Please sign in to comment.