Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Runtime/Scripts/MeshAnimationAsset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public class MeshAnimationAsset : ScriptableObject
[SerializeField]
internal bool npotBakedTexture = false;

[SerializeField]
internal bool linearColorSpace = false;

[PropertySpace]
[Required]
[SerializeField]
Expand Down Expand Up @@ -107,6 +110,11 @@ public string GetValidationMessage()
}

#if UNITY_EDITOR
private void Reset()
{
linearColorSpace = UnityEditor.PlayerSettings.colorSpace == ColorSpace.Linear;
}

[DisableIf(nameof(IsInvalid))]
[PropertySpace(10)]
[Button(ButtonSizes.Large, Name = "Bake")]
Expand Down
3 changes: 2 additions & 1 deletion Runtime/Scripts/MeshAnimationBaker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ private static void CreateTexture(MeshAnimationAsset asset, out bool aborted)

var texWidth = asset.npotBakedTexture ? vertexCount : Mathf.NextPowerOfTwo(vertexCount);
var textHeight = asset.npotBakedTexture ? framesCount : Mathf.NextPowerOfTwo(framesCount);
var linear = asset.linearColorSpace;

var texture = new Texture2D(texWidth, textHeight, TextureFormat.RGB24, false)
var texture = new Texture2D(texWidth, textHeight, TextureFormat.RGB24, false, linear)
{
name = asset.name + " Texture",
hideFlags = HideFlags.NotEditable,
Expand Down