If you have custom DOTween extensions, you can add them to the sequencer by extending DOTweenActionBase. This allows you to define a specific TargetComponentType and implement the CreateTween method.
Note: Tweens are created during the PrepareToPlay method on Awake and are paused to ensure performance.
[Serializable]
public sealed class ChangeMaterialStrengthDOTweenAction : DOTweenActionBase
{
public override string DisplayName => "Change Material Strength";
public override Type TargetComponentType => typeof(Renderer);
[SerializeField, Range(0,1)]
private float materialStrength = 1;
public override bool CreateTween(GameObject target, float duration, int loops, LoopType loopType)
{
Renderer renderer = target.GetComponent<Renderer>();
if (renderer == null)
return false;
TweenerCore<float, float, FloatOptions> materialTween = renderer.sharedMaterial.DOFloat(materialStrength, "Strength", duration);
SetTween(materialTween, loops, loopType);
return true;
}
}