How can I make my player object go up when a key is held, then it falls down when it’s let go in 2D.
To handle the jump state, you can do this:
[SerializedField] Keycode jumpKey;
public bool jumping {get ; private set;}
void Update ()
{
if (Input.GetKeyDown (jumpKey))
jumping = true;
else if (Input.GetKeyUp (jumpKey))
jumping = false;
}
Then, you can use Transform component, AnimationCurve, Animator, RigidBody2D, there are many ways you can make a character jump.