UnityGameProjectsCode / Rise2Point0Game / Tools / FollowPlayerY.cs
FollowPlayerY.cs
Raw
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);
    }
}