using UnityEngine; public class FollowPlayerY : MonoBehaviour { //set height of attached object using the height of the player. GameObject playerObject; float playerHeight = 0; private void Start() { playerObject = ObjectManager.GetObject(0); } private void Update() { playerHeight = playerObject.transform.position.y; transform.position = new Vector2(0, playerHeight - 15); } }