質問編集履歴

7

タグ更新

2022/06/08 08:38

投稿

ryou1252
ryou1252

スコア1

test CHANGED
File without changes
test CHANGED
File without changes

6

タグ追加

2022/06/08 08:24

投稿

ryou1252
ryou1252

スコア1

test CHANGED
File without changes
test CHANGED
File without changes

5

エラー内容

2022/06/07 15:27

投稿

ryou1252
ryou1252

スコア1

test CHANGED
File without changes
test CHANGED
@@ -3,11 +3,11 @@
3
3
  全くの初心者なので分からないことばかりですがよろしくお願いします
4
4
 
5
5
  ### エラー内容
6
- 以前書いたNull~のエラーは消えましたが別のエラー
6
+ 以前書いたNull~のエラーは消えましたが別のエラーが出て困っています
7
+ (コード内のText qlabelのところです)
7
8
 
8
9
  Assets\QuizMgr.cs(20,10): error CS1061: 'Text' does not contain a definition for 'Text' and no accessible extension method 'Text' accepting a first argument of type 'Text' could be found (are you missing a using directive or an assembly reference?)
9
10
 
10
- がでで困っています
11
11
 
12
12
  ### やったこと
13
13
 

4

タイトル変更

2022/06/07 15:20

投稿

ryou1252
ryou1252

スコア1

test CHANGED
@@ -1 +1 @@
1
- unityのクイズゲームの正誤判定ができません
1
+ unityのテキスト表示ができません
test CHANGED
File without changes

3

コード修正

2022/06/07 08:56

投稿

ryou1252
ryou1252

スコア1

test CHANGED
File without changes
test CHANGED
@@ -16,7 +16,6 @@
16
16
 
17
17
  ### コード
18
18
 
19
-
20
19
  using UnityEngine;
21
20
  using System.Collections;
22
21
  using UnityEngine.UI;//UI オブジェクトを扱う時は必須
@@ -28,7 +27,7 @@
28
27
 
29
28
  //アタッチしたオブジェクトが呼ばれた時に実行される。
30
29
  void Start () {
31
- QuestionLabelSet ();
30
+ QLabelSet ();
32
31
  AnswerLabelSet ();
33
32
  }
34
33
 
@@ -50,6 +49,7 @@
50
49
  }
51
50
 
52
51
  }
52
+
53
53
  ### 画像
54
54
 
55
55
 

2

文字修正

2022/06/07 08:54

投稿

ryou1252
ryou1252

スコア1

test CHANGED
File without changes
test CHANGED
@@ -4,7 +4,6 @@
4
4
 
5
5
  ### エラー内容
6
6
  以前書いたNull~のエラーは消えましたが別のエラー
7
- Assets\QuizMgr.cs(12,4): error CS0103: The name 'QuestionLabelSet' does not exist in the current context
8
7
 
9
8
  Assets\QuizMgr.cs(20,10): error CS1061: 'Text' does not contain a definition for 'Text' and no accessible extension method 'Text' accepting a first argument of type 'Text' could be found (are you missing a using directive or an assembly reference?)
10
9
 

1

別のエラーがでて困っています

2022/06/07 08:33

投稿

ryou1252
ryou1252

スコア1

test CHANGED
File without changes
test CHANGED
@@ -2,31 +2,42 @@
2
2
  サイトはhttps://engineer.blog.lancers.jp/ios/ugui_quiz_unity/を参考にしました
3
3
  全くの初心者なので分からないことばかりですがよろしくお願いします
4
4
 
5
+ ### エラー内容
6
+ 以前書いたNull~のエラーは消えましたが別のエラー
7
+ Assets\QuizMgr.cs(12,4): error CS0103: The name 'QuestionLabelSet' does not exist in the current context
8
+
9
+ Assets\QuizMgr.cs(20,10): error CS1061: 'Text' does not contain a definition for 'Text' and no accessible extension method 'Text' accepting a first argument of type 'Text' could be found (are you missing a using directive or an assembly reference?)
10
+
11
+ がでで困っています
5
12
 
6
13
  ### やったこと
7
14
 
8
15
  類似のサイトで正誤判定について調べました
16
+ エラーについて調べました
9
17
 
10
18
  ### コード
11
19
 
12
- 少しだけ自分で考えて書きました
20
+
13
21
  using UnityEngine;
14
22
  using System.Collections;
15
23
  using UnityEngine.UI;//UI オブジェクトを扱う時は必須
16
24
 
17
25
  public class QuizMgr : MonoBehaviour {
18
26
 
27
+ public GameObject QLabel;
28
+ public string Text;
29
+
19
30
  //アタッチしたオブジェクトが呼ばれた時に実行される。
20
31
  void Start () {
21
- QuestionLabelSet ();
32
+ QuestionLabelSet ();
22
33
  AnswerLabelSet ();
23
34
  }
24
35
 
25
- private void QuestionLabelSet(){
36
+ private void QLabelSet(){
26
37
  //特定の名前のオブジェクトを検索してアクセス
27
- Text qLabel = GameObject.Find("Quiz/QLabel").GetComponentInChildren<Text> ();
38
+ Text qLabel = GameObject.Find("qLabel").GetComponentInChildren<Text> ();
28
39
  //データをセットすることで、既存情報を上書きできる
29
- qLabel.text = "what is this pokemon?";
40
+ qLabel.Text = "what is this pokemon?";
30
41
  }
31
42
 
32
43
  private void AnswerLabelSet(){
@@ -34,21 +45,16 @@
34
45
  string[] array = new string[]{"pikachu","pika","pipi","pippi"};
35
46
  //ボタンが4つあるのでそれぞれ代入
36
47
  for (int i=1; i<=4 ; i++){
37
- Text ansLabel = GameObject.Find("Quiz/AnsButton" + i).GetComponentInChildren<Text> ();
48
+ Text ansLabel = GameObject.Find("AnsButton" + i).GetComponentInChildren<Text> ();
38
49
  ansLabel.text = array[i-1];
39
50
  }
40
51
  }
41
52
 
42
53
  }
43
-
44
54
  ### 画像
45
55
 
46
56
 
47
-
48
- ![イメージ説明](https://ddjkaamml8q8x.cloudfront.net/questions/2022-06-06/31cea702-258a-44a1-af68-c77a445cdb4f.png)
57
+ ![イメージ説明](https://ddjkaamml8q8x.cloudfront.net/questions/2022-06-07/b1189308-23ef-487f-a916-b7161b300d20.png)
49
-
50
-
51
- ![イメージ説明](https://ddjkaamml8q8x.cloudfront.net/questions/2022-06-06/ef36090c-70d3-478e-b2c8-f169d8ed4585.png)
52
58
 
53
59
  ↑画像で示すとこちらです
54
60
  ページの遷移をしてもテキストがのりません。。。