using DG.Tweening; using UnityEngine; public class ZoomTween : MonoBehaviour { [Header("Material and Property")] public Material targetMaterial; [Tooltip("Zoom range e.g., from 0.1 (zoomed in) to 5 (zoomed out)")] public float minZoom = 0.1f; public float maxZoom = 2f; public float speed = 1f; [Tooltip("Name of the shader property (must match _ZoomUvAmount)")] private readonly string zoomProperty = "_ZoomUvAmount"; private float t; void Update() { if (!targetMaterial) return; t += Time.deltaTime * speed; // Animate using ping-pong float zoom = Mathf.Lerp(minZoom, maxZoom, Mathf.PingPong(t, 1f)); targetMaterial.SetFloat(zoomProperty, zoom); } }