I imagine this is a new-coder problem, but I have a script set up where when I hold the space bar, the distance in a 2D Spring Joint is supposed to decrease over time. The issue is that the distance only decreases for the first frame. Here is the code I have set up:
if (joint != null && Input.GetButtonDown("Jump"))
{
joint.distance -= Time.deltaTime * 0.2f;
}
The logic is that when the spring joint (joint) exists, or is not null and when Jump is being pressed, then the joint distance decreases. Any help would be appreciated!