# 問題のコード
CS0103: The name 'Rcount' does not exist in the current context
CS0103: The name 'Bcount' does not exist in the current context
の二つのエラーが出てしまいます。
以下、問題のコードです。
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4using UnityEngine.SceneManagement; 5 6public class omo : MonoBehaviour 7{ 8 public blueMODEL bluemodel; 9 public redMODEL redmodel; 10 11 void Start() 12 { 13 int Rcount; 14 Rcount = redmodel.akairo; 15 Rcount += 5; 16 17 int Bcount; 18 Bcount = bluemodel.aoiro; 19 Bcount += 5; 20 } 21 22 23public void move() 24 { 25 if(Rcount = 15) 26 { 27 SceneManager.LoadScene("BASIC"); 28 } 29 if(Bcount = 25) 30 { 31 SceneManager.LoadScene("SLOW"); 32 } 33 34 } 35} 36
EventTrrigerに使用するために作成したスクリプトです。
タイプミスではなさそうなのですが、エラーが出る原因が分かりません。
C#に詳しい方、同じエラーを経験した方などいましたら
ご教授お願いいたします。
回答2件
あなたの回答
tips
プレビュー