Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
using UnityEngine;
public class MoveTowardsExample : MonoBehaviour
[SerializeField] private Vector3 target = new Vector3(1, 1, 1);
[SerializeField] private float speed = 1;
private void Update()
// Moves the object to target position
transform.position = Vector3.MoveTowards(transform.position, target, Time.deltaTime * speed);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment