Dotween v2 How to do a DOVirtual.Color

1.6k views Asked by At

I have been trying to make a RGB effect with a color using DOTween, i have research about DOVirtual.Color but i havent found anything i got the 3 first parameters, but what means "TweenCallback onVirtualUpdate" ?? Image of the function

I have try to put some values to update while is in runtime the tween or a function tu get a color parameter but nothing had succes

1

There are 1 answers

0
stazik On

The duration of the tween can be several frames. The callback onVirtualUpdate is a function that will be called every frame and contains the current color.

using DG.Tweening;
using UnityEngine;

public class ColorChanger : MonoBehaviour
{
    [SerializeField] private MeshRenderer meshRenderer;

    private void Awake()
    {
        DOVirtual.Color(Color.black, Color.white, 10, (value) =>
        {
            meshRenderer.material.color = value;
        });
    }
}