質問編集履歴

3

文章の変更

2019/08/08 08:32

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,9 +1,103 @@
1
1
  Unityで2Dアクションゲームを作っています。
2
2
 
3
- ですが実行してみると以下のようなエラーが出ました。![イメージ説明](0aa676e0b3d05ad3b1adfd76dcf4c2bb.png)
3
+ ですが実行るとのようなエラーが出ました。![イメージ説明](5c6d8087a45c87b5c77900cccae35e92.png)
4
4
 
5
- これはどういう意味ですか?ご教授お願いします。
5
+ ```c#
6
6
 
7
- ヒエラルキーとインスペクターのスクリーンショットです。
7
+ using System.Collections;
8
8
 
9
+ using System.Collections.Generic;
10
+
11
+ using UnityEngine;
12
+
13
+ using UnityEngine.UI; // UI機能の利用に必要なusing文
14
+
15
+
16
+
17
+ public class StageSelectManager : MonoBehaviour
18
+
19
+ {
20
+
21
+
22
+
23
+ // メンバ変数宣言
24
+
25
+ public Text text_BestTime_1; // ステージ1最速クリアタイム表示UI
26
+
27
+ public Text text_BestTime_2; // ステージ2最速クリアタイム表示UI
28
+
29
+ public Text text_BestTime_3; // ステージ3最速クリアタイム表示UI
30
+
31
+
32
+
33
+ // 起動時に1回だけ呼び出されるメソッド
34
+
35
+ private void Start()
36
+
37
+ {
38
+
39
+ // 最速クリアタイムをUIに表示
40
+
41
+ Data data = GameObject.Find("DataManager").GetComponent<Data>(); // データスクリプトを取得
42
+
43
+ text_BestTime_1.text = "BestTime : \n" + data.BestTime_01.ToString("F2");
44
+
45
+ text_BestTime_2.text = "BestTime : \n" + data.BestTime_02.ToString("F2");
46
+
47
+ text_BestTime_3.text = "BestTime : \n" + data.BestTime_03.ToString("F2");
48
+
49
+ }
50
+
51
+
52
+
9
- ![イメージ説明](48df915480c9e1a817ece4a80677865e.png)
53
+ // SampleScene(バトル画面)へのシーン遷移を行うメソッド
54
+
55
+ // ボタン[StageButton_1]の入力時に呼び出される
56
+
57
+ public void TransitionScene_Stage1()
58
+
59
+ {
60
+
61
+ // SampleSceneをロードする
62
+
63
+ GameObject.Find("FadeManager").GetComponent<Fade>().TransitionScene("Stage1");
64
+
65
+ GetComponent<AudioSource>().Play(); // ゲームオブジェクトに付いている効果音を再生する
66
+
67
+ }
68
+
69
+ // ボタン[StageButton_2]の入力時に呼び出される
70
+
71
+ public void TransitionScene_Stage2()
72
+
73
+ {
74
+
75
+ // SampleSceneをロードする
76
+
77
+ GameObject.Find("FadeManager").GetComponent<Fade>().TransitionScene("Stage2");
78
+
79
+ GetComponent<AudioSource>().Play(); // ゲームオブジェクトに付いている効果音を再生する
80
+
81
+ }
82
+
83
+ // ボタン[StageButton_3]の入力時に呼び出される
84
+
85
+ public void TransitionScene_Stage3()
86
+
87
+ {
88
+
89
+ // SampleSceneをロードする
90
+
91
+ GameObject.Find("FadeManager").GetComponent<Fade>().TransitionScene("Stage3");
92
+
93
+ GetComponent<AudioSource>().Play(); // ゲームオブジェクトに付いている効果音を再生する
94
+
95
+ }
96
+
97
+ }
98
+
99
+ ```
100
+
101
+ このコードの18行目がエラーになっています。
102
+
103
+ どこもスペルミスなどはないと思いますが、どうかご教授お願いします。

2

文章の変更

2019/08/08 08:32

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -3,3 +3,7 @@
3
3
  ですが、実行してみると以下のようなエラーが出ました。![イメージ説明](0aa676e0b3d05ad3b1adfd76dcf4c2bb.png)
4
4
 
5
5
  これはどういう意味ですか?ご教授お願いします。
6
+
7
+ ヒエラルキーとインスペクターのスクリーンショットです。
8
+
9
+ ![イメージ説明](48df915480c9e1a817ece4a80677865e.png)

1

文の修正をしました。

2019/08/08 05:04

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- NullReferenceExceptionというエラー わかりせん
1
+ 実行したら、NullReferenceExceptionというエラーが出
test CHANGED
@@ -2,6 +2,4 @@
2
2
 
3
3
  ですが、実行してみると以下のようなエラーが出ました。![イメージ説明](0aa676e0b3d05ad3b1adfd76dcf4c2bb.png)
4
4
 
5
- コードはこちらです。![イメージ説明](ada459f37353b252924d49d5f8ac4ac9.png)
6
-
7
- 間違えているとろがわかりません。どうかご教授お願いします。
5
+ れはどういう意味ですご教授お願いします。