質問編集履歴

4

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

2019/10/19 14:33

投稿

george6493
george6493

スコア25

test CHANGED
File without changes
test CHANGED
@@ -128,7 +128,7 @@
128
128
 
129
129
 
130
130
 
131
- StartCoroutine(myCoroutine());//エラーメッセージ発生箇所
131
+ StartCoroutine(myCoroutine());
132
132
 
133
133
 
134
134
 
@@ -150,7 +150,7 @@
150
150
 
151
151
  type = "hogehogehoge";
152
152
 
153
- StartCoroutine(button1Script.myCoroutine());
153
+ StartCoroutine(button1Script.myCoroutine());//エラーメッセージ発生箇所
154
154
 
155
155
  ```
156
156
 

3

2019/10/19 14:33

投稿

george6493
george6493

スコア25

test CHANGED
File without changes
test CHANGED
@@ -128,7 +128,7 @@
128
128
 
129
129
 
130
130
 
131
- StartCoroutine(myCoroutine());
131
+ StartCoroutine(myCoroutine());//エラーメッセージ発生箇所
132
132
 
133
133
 
134
134
 

2

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

2019/10/19 11:54

投稿

george6493
george6493

スコア25

test CHANGED
File without changes
test CHANGED
@@ -42,7 +42,7 @@
42
42
 
43
43
  ```C#
44
44
 
45
- IEnumerator myCoroutine()
45
+ public IEnumerator myCoroutine()
46
46
 
47
47
  {
48
48
 
@@ -144,6 +144,8 @@
144
144
 
145
145
  ```C#
146
146
 
147
+ public Button1Script button1Script;//GUIでできたエリアにhierarchyからButton1を突っ込む
148
+
147
149
  void Update(){
148
150
 
149
151
  type = "hogehogehoge";

1

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

2019/10/19 10:05

投稿

george6493
george6493

スコア25

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