// ジャンプの力 public float jumpPower = 40; // ジャンプ中判定 private bool isJump = false; // 接地判定 private bool isGround = false; // Update is called once per frame void FixedUpdate () { // Playerの移動速度、方向をセット setMoveDirection(); } public void PushJumpButton() { // 接地している状態 if(isGround) { // ジャンプ中 isJump = true; isGround = false; } } // Playerの移動速度、方向をセット private void setMoveDirection() { if(isJump) { rb.AddForce(Vector2.up * jumpPower); isJump = false; } } private void OnCollisionEnter2D(Collision2D collision) { // 接地判定 if("Ground" == collision.gameObject.tag) { isGround = true; Debug.Log(isGround); } }