How to make it where my character moves to the right automatically and make it able to move down and up the y-axis.,How to make my character constantly move to the right but still allow me to move them only up or down the y-axis.

I’m wondering how to make it where I can make my character constantly move to the right automatically at a fixed speed till it reaches its end point and how to allow it to only move it up and down manually (Not able to move it right or left manually),So, I want to be able to make it where my character always moves to the right till the end point but I want it where I am still able to move the character up and down only (Not able to move left manually or right manually)

Hello :slight_smile:
You can try with this.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMoveRight : MonoBehaviour {

    [SerializeField]
    private float speed = 10f;

    [SerializeField]
    private float verticalSpeed = 5.0f;

    private Rigidbody2D rb;

	void Start ()
    {
        rb = GetComponent<Rigidbody2D>();
	}
	
	void FixedUpdate ()
    {
        float move = Input.GetAxis("Vertical");

        rb.velocity = new Vector2(speed, move * verticalSpeed);
    }
}