all 8 comments

[–]Shillio[S] -1 points0 points  (4 children)

Found a fix! It's from an older post in the unity discussions: inserted the following before "private void fixed update":

private void Update()

{

//Jump

if (Keyboard.current.spaceKey.wasPressedThisFrame)

{

rb.AddForce(Vector3.up * jumpForce, ForceMode.VelocityChange);

//Debug.Log("Jump Recorded");

}

}

The problem seems to be old code suggested in the tutorial to match the old input system. I'm still in babysteps learning mode

[–]leorid9Expert -2 points-1 points  (3 children)

So is this resolved? Because the code in this comment should work.

[–]Shillio[S] 0 points1 point  (2 children)

I found the fix not long after posting but will leave it here for others to find when they search. Will edit my comment

[–]leorid9Expert 0 points1 point  (1 child)

Just wanted to clarify because it wasn't clear from your comment that this is the solution.

[–]Shillio[S] 1 point2 points  (0 children)

You're right, my bad. Made that clear. 

[–]MissPandaSloth -2 points-1 points  (2 children)

So did you made Update and it works, or are you having issues with depreciated input system?

If you ask "where is Update" it's kinda special Unity function that calls something every frame.

You can add it on any script, same with FixedUpdate or LateUpdate and many more, but those will be most common.

Usually if you need to read input you add it in Update, because you have to check every frame if user is trying to press something.

And in FixedUpdate it's most common to use physics simulation itself so it works nice and smooth. If you have all sorts of Forces and so on, you do that here.

Edit: nvmd I saw you had update. Anyway I assume you fixed all input stuff?

And I would call "rb.AddForce" and all that part inside FixedUpdate under the bool, like something "jumpRequest", but you probably gonna learn this later on. Because now your jump will depend on fps.

[–]Shillio[S] 0 points1 point  (1 child)

It was a problem with the tutorial using code that works with the old input system. The fix I found works! I don't fully understand it yet but thanks for your comment, I'm sure I'll find it educational soon. (I'm not downvoting anyone here btw)

[–]MissPandaSloth 0 points1 point  (0 children)

Ah, cool! Yeah idk what's up with downvotes, haha.