My character can jump infinity but I only want them to jump one time. Code: using System.Collections; using System.Collections.Generic; using System.Diagnostics; using UnityEngine; public class Platformer : MonoBehaviour { // Start is called before the first frame update Rigidbody2D rb; public float moveBy; public float speed; //public float radius; public LayerMask layerMask; public bool isGrounded; public Transform point; public float jumpHeight; public float jumpSpeed; void Start() { rb = GetComponent<Rigidbody2D>(); } // Update is called once per frame void Update() { float x = Input.GetAxisRaw("Horizontal"); moveBy = x * speed; rb.velocity = new Vector2(moveBy, rb.velocity.y); //sGrounded = Physics2D.OverlapCircle(point.position, radius, layerMask); isGrounded = true; // Jump code //f (isGrounded == true) if (Input.GetButtonDown("Jump")) { rb.velocity = new Vector2(rb.velocity.y, jumpHeight); isGrounded = false; } } }
How to report your problem productively in the Unity3D forums: http://plbm.com/?p=220 How to understand compiler and other errors and even fix them yourself: https://forum.unity.com/threads/ass...3-syntax-error-expected.1039702/#post-6730855 If you post a code snippet, ALWAYS USE CODE TAGS: How to use code tags: https://forum.unity.com/threads/using-code-tags-properly.143875/ Also, consider this: