TankのHPを作る

TankHPの作成
using UnityEngine;
public class TankHP : MonoBehaviour
{
public int HP;
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.CompareTag("EnemyShell"))
{
HP -= 1;
if (HP < 1)
{
// ノンアクティブにする(テクニック)
this.gameObject.SetActive(false);
}
}
}
}



【Unity6版】BattleTank(全31回)
他のコースを見る