UnityScripterAI
Discord ↗
Link Copied to Clipboard
×
"Tweening"
using UnityEngine; using System.Collections; public class TweeningExample : MonoBehaviour { public GameObject targetObject; public Vector3 targetPosition; public float tweenDuration = 1.0f; private Vector3 startPosition; private float startTime; // Use this for initialization void Start() { startPosition = targetObject.transform.position; startTime = Time.time; } // Update is called once per frame void Update() { float progress = (Time.time - startTime) / tweenDuration; targetObject.transform.position = Vector3.Lerp(startPosition, targetPosition, progress); if (progress >= 1.0f) { // Tweening completed, you can perform any action here Debug.Log("Tweening completed"); } } }