部品だけ書きます
床にタグつけて
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerC : MonoBehaviour
{
public static int jumpC = 0;//ジャンプカウント 0ならジャンプ可能
void Start()
{
jumpC = 0;
}
void Update()
{
//ジャンプ
if (Input.GetButtonDown("Jump")&&jumpC==0)
{
rb.AddForce(0, jumpPower, 0);
jumpC = 1;
}
}
//これはUpdateの外に書かないといけないみたい
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "床につけたタグ名")
{
jumpC = 0;
}
}
}
これをプレイヤー(プレイヤープログラム)にいれる