Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public class ObjectMoverToTarget : MonoBehaviour
- {
- [SerializeField] Transform _player;
- [Range (0, 100)]
- [SerializeField] float _speed = 10f;
- // Update is called once per frame
- void Update ()
- {
- transform.position = Vector2.Lerp (transform.position, _player.position, Time.deltaTime * _speed);
- }
- }
Add Comment
Please, Sign In to add comment