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

質問編集履歴

4

エラーメッセージ発生箇所が誤っていたので修正しました。

2019/10/19 14:33

投稿

george6493
george6493

スコア25

title CHANGED
File without changes
body CHANGED
@@ -63,7 +63,7 @@
63
63
  {
64
64
  type = "hogehoge";//こちらも別スクリプトから取得してきた変数
65
65
 
66
- StartCoroutine(myCoroutine());//エラーメッセージ発生箇所
66
+ StartCoroutine(myCoroutine());
67
67
 
68
68
  }
69
69
  ```
@@ -74,7 +74,7 @@
74
74
  public Button1Script button1Script;//GUIでできたエリアにhierarchyからButton1を突っ込む
75
75
  void Update(){
76
76
  type = "hogehogehoge";
77
- StartCoroutine(button1Script.myCoroutine());
77
+ StartCoroutine(button1Script.myCoroutine());//エラーメッセージ発生箇所
78
78
  ```
79
79
 
80
80
  #教えていただきたいこと

3

2019/10/19 14:33

投稿

george6493
george6493

スコア25

title CHANGED
File without changes
body CHANGED
@@ -63,7 +63,7 @@
63
63
  {
64
64
  type = "hogehoge";//こちらも別スクリプトから取得してきた変数
65
65
 
66
- StartCoroutine(myCoroutine());
66
+ StartCoroutine(myCoroutine());//エラーメッセージ発生箇所
67
67
 
68
68
  }
69
69
  ```

2

Button2Scriptにpublicで宣言し、GUIから追加しております!コード中に明記いたしました。また、元のCoroutineもPublicにしてありました。

2019/10/19 11:54

投稿

george6493
george6493

スコア25

title CHANGED
File without changes
body CHANGED
@@ -20,7 +20,7 @@
20
20
  #書いたコード抜粋
21
21
  **Button1Script**
22
22
  ```C#
23
- IEnumerator myCoroutine()
23
+ public IEnumerator myCoroutine()
24
24
  {
25
25
  bool once = true;
26
26
  string url;
@@ -71,6 +71,7 @@
71
71
 
72
72
  **Button2Script**
73
73
  ```C#
74
+ public Button1Script button1Script;//GUIでできたエリアにhierarchyからButton1を突っ込む
74
75
  void Update(){
75
76
  type = "hogehogehoge";
76
77
  StartCoroutine(button1Script.myCoroutine());

1

タイトルに出たエラーを記しました

2019/10/19 10:05

投稿

george6493
george6493

スコア25

title CHANGED
@@ -1,1 +1,1 @@
1
- UnityのC#スクリプトで、別のスクリプトで書いたCoroutineを実行したい
1
+ UnityのC#スクリプトで、別のスクリプトで書いたCoroutineを実行したい/NullReferenceExceptionがでる
body CHANGED
File without changes