質問編集履歴

2

codeの追加

2020/06/24 10:00

投稿

n_nakai
n_nakai

スコア1

test CHANGED
File without changes
test CHANGED
@@ -146,6 +146,46 @@
146
146
 
147
147
 
148
148
 
149
+ using System.Collections;
150
+
151
+ using System.Collections.Generic;
152
+
153
+ using UnityEngine;
154
+
155
+ using UnityEngine.UI;
156
+
157
+
158
+
159
+ public class GameDirector : MonoBehaviour
160
+
161
+ {
162
+
163
+ GameObject hpGauge;
164
+
165
+ // Start is called before the first frame update
166
+
167
+ void Start()
168
+
169
+ {
170
+
171
+ this.hpGauge = GameObject.Find("hpGause");
172
+
173
+ }
174
+
175
+
176
+
177
+ // Update is called once per frame
178
+
179
+ public void DecreaseHp()
180
+
181
+ {
182
+
183
+ this.hpGauge.GetComponent<Image>().fillAmount -= 0.1f;
184
+
185
+ }
186
+
187
+ }
188
+
149
189
  ```
150
190
 
151
191
 

1

codeを見やすくした

2020/06/24 10:00

投稿

n_nakai
n_nakai

スコア1

test CHANGED
File without changes
test CHANGED
@@ -5,8 +5,6 @@
5
5
  矢に当たるとHPゲージが減る
6
6
 
7
7
  ### 発生している問題・エラーメッセージ
8
-
9
-
10
8
 
11
9
  NullReferenceException: Object reference not set to an instance of an object
12
10
 
@@ -18,7 +16,11 @@
18
16
 
19
17
 
20
18
 
19
+
20
+
21
21
  ### 該当のソースコード
22
+
23
+ ```ここに言語を入力
22
24
 
23
25
  using System;
24
26
 
@@ -144,6 +146,8 @@
144
146
 
145
147
 
146
148
 
149
+ ```
150
+
147
151
 
148
152
 
149
153
  ### 試したこと