Unityで2Dアクションゲームを作っています。
ですが実行すると次のようなエラーが出ました。↓
c#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4using UnityEngine.UI; // UI機能の利用に必要なusing文 5 6public class StageSelectManager : MonoBehaviour 7{ 8 9 // メンバ変数宣言 10 public Text text_BestTime_1; // ステージ1最速クリアタイム表示UI 11 public Text text_BestTime_2; // ステージ2最速クリアタイム表示UI 12 public Text text_BestTime_3; // ステージ3最速クリアタイム表示UI 13 14 // 起動時に1回だけ呼び出されるメソッド 15 private void Start() 16 { 17 // 最速クリアタイムをUIに表示 18 Data data = GameObject.Find("DataManager").GetComponent<Data>(); // データスクリプトを取得 19 text_BestTime_1.text = "BestTime : \n" + data.BestTime_01.ToString("F2"); 20 text_BestTime_2.text = "BestTime : \n" + data.BestTime_02.ToString("F2"); 21 text_BestTime_3.text = "BestTime : \n" + data.BestTime_03.ToString("F2"); 22 } 23 24 // SampleScene(バトル画面)へのシーン遷移を行うメソッド 25 // ボタン[StageButton_1]の入力時に呼び出される 26 public void TransitionScene_Stage1() 27 { 28 // SampleSceneをロードする 29 GameObject.Find("FadeManager").GetComponent<Fade>().TransitionScene("Stage1"); 30 GetComponent<AudioSource>().Play(); // ゲームオブジェクトに付いている効果音を再生する 31 } 32 // ボタン[StageButton_2]の入力時に呼び出される 33 public void TransitionScene_Stage2() 34 { 35 // SampleSceneをロードする 36 GameObject.Find("FadeManager").GetComponent<Fade>().TransitionScene("Stage2"); 37 GetComponent<AudioSource>().Play(); // ゲームオブジェクトに付いている効果音を再生する 38 } 39 // ボタン[StageButton_3]の入力時に呼び出される 40 public void TransitionScene_Stage3() 41 { 42 // SampleSceneをロードする 43 GameObject.Find("FadeManager").GetComponent<Fade>().TransitionScene("Stage3"); 44 GetComponent<AudioSource>().Play(); // ゲームオブジェクトに付いている効果音を再生する 45 } 46}
このコードの18行目がエラーになっています。
どこもスペルミスなどはないと思いますが、どうかご教授お願いします。
わかりました。
回答4件
あなたの回答
tips
プレビュー