前提・実現したいこと
敵の攻撃にplayerが当たった時GameOverというシーンを読み込ませる
発生している問題・エラーメッセージ
Assets/RockController.cs(25,9): error CS0103: The name `col' does not exist in the current context
該当のソースコード
using UnityEngine; using System.Collections; using UnityEngine.SceneManagement; public class RockController : MonoBehaviour { float fallSpeed; float rotSpeed; void Start () { this.fallSpeed = 0.5f + 0.1f * Random.value; this.rotSpeed = 5f + 3f * Random.value; } void Update () { transform.Translate( 0, -fallSpeed, 0, Space.World); transform.Rotate(0, 0, rotSpeed ); if (transform.position.y < -15.5f) { Destroy(gameObject); } { if (col.gameObject.CompareTag("player"); { SceneManager.LoadScene("GameOver"); } } } }
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。