mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-21 01:36:05 +08:00
20 lines
400 B
C#
20 lines
400 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using DG.Tweening;
|
|
|
|
public class MaterialLerp : BrainBase
|
|
{
|
|
public Renderer target;
|
|
public Material switchMaterial;
|
|
|
|
IEnumerator Start()
|
|
{
|
|
yield return new WaitForSeconds(0.7f);
|
|
|
|
float n = 0;
|
|
DOTween.To(()=> n, x=> n = x, 1, 2).SetEase(Ease.Linear)
|
|
.OnUpdate(()=> {
|
|
target.material.Lerp(target.material, switchMaterial, n);
|
|
});
|
|
}
|
|
} |