Skip to content

HDR support in TweenSettings<Color> #103

Discussion options

You must be logged in to vote

Because TweenSettings is a generic struct it doesn't have the ColorUsageAttribute on its startValue and endValue fields.

As a workaround, it's possible to create a new TweenSettingsHDR struct that can be used in places where an HDR version of TweenSettings is needed:

using System;
using PrimeTween;
using UnityEngine;

[Serializable]
public struct TweenSettingsHDR {
    [ColorUsage(true, true)]
    public Color startValue, endValue;
    public TweenSettings settings;

    public static implicit operator TweenSettings<Color>(TweenSettingsHDR hdr) => new TweenSettings<Color>(hdr.startValue, hdr.endValue, hdr.settings);
}

Usage example:

[SerializeField] TweenSettingsHDR tweenSettingsHDR;

public

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by KyryloKuzyk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant