質問するログイン新規登録

質問編集履歴

1

ソースコードはそのままコピペで、エラーは別のところに書きました。

2019/09/16 12:50

投稿

tyc
tyc

スコア6

title CHANGED
File without changes
body CHANGED
@@ -8,8 +8,26 @@
8
8
    yield return new WaitForSeconds (1.0f);
9
9
  }
10
10
  ```
11
- というような文を追加するといろんなところでエラーがで出ます。エラーは出ているところで下のソースコードにコメントで書いています。
11
+ というような文を追加するといろんなところでエラーがで出ます。
12
12
 
13
+ **エラー⑴ "IEnumerator oldTV(){" のところ(27行目)**
14
+ ```
15
+ Assets/TVtext.cs(27,20): error CS1525: Unexpected symbol `(', expecting `,', `;', or `='
16
+ ```
17
+ **エラー⑵⑶ "} else {" のところ(34行目) ここでは2つエラーが出ています。**
18
+ ```
19
+ Assets/TVtext.cs(34,8): error CS1519: Unexpected symbol `else' in class, struct, or interface member declaration
20
+ ```
21
+
22
+ ```
23
+ Assets/TVtext.cs(34,10): error CS9010: Primary constructor body is not allowed
24
+ ```
25
+
26
+ **エラー⑷ "}" のところ(41行目)**
27
+ ```
28
+ Assets/TVtext.cs(41,0): error CS1525: Unexpected symbol `}'
29
+ ```
30
+
13
31
  ### 該当のソースコード
14
32
 
15
33
  ```C#
@@ -39,24 +57,21 @@
39
57
 
40
58
  public void Buttion(){
41
59
  if (TVswitch == 0) {
42
- IEnumerator oldTV(){ //エラー:Assets/TVtext.cs(27,20): error CS1525: Unexpected symbol `(', expecting `,', `;', or `='
60
+ IEnumerator oldTV(){
43
-
44
61
  //テレビをつける
45
62
  mission.text = "赤い風船";
46
63
  backlight.SetActive (true);
47
64
  yield return new WaitForSeconds (1.0f);
48
65
  }
49
66
  TVswitch = 1;
50
- } else { //エラー1:Assets/TVtext.cs(34,8): error CS1519: Unexpected symbol `else' in class, struct, or interface member declaration
51
- //エラー2:Assets/TVtext.cs(34,10): error CS9010: Primary constructor body is not allowed
67
+ } else {
52
68
  //テレビを消す
53
69
  mission.text = "";
54
70
  backlight.SetActive (false);
55
71
  TVswitch = 0;
56
72
  }
57
73
  }
58
- } //エラー:Assets/TVtext.cs(41,0): error CS1525: Unexpected symbol `}'
74
+ }
59
-
60
75
  ```
61
76
 
62
77
  ### 試したこと